index.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706
  1. <template>
  2. <div class="app-container">
  3. <el-row :gutter="20">
  4. <!--机构数据-->
  5. <el-col :span="4" :xs="24">
  6. <org-tree v-model="queryParams.belongOrgId" @defaultKey="getDefaultKey" @checkChange="checkChange"
  7. @click="clickTreeNode" hangsheTree :defaultCheckSub="false"></org-tree>
  8. </el-col>
  9. <!--搜索栏-->
  10. <el-col :span="20" :xs="24">
  11. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
  12. label-width="100px">
  13. <el-form-item label="培训主题" prop="planName">
  14. <el-input v-model="queryParams.planName" placeholder="请输入培训主题" clearable
  15. maxlength="50"
  16. @keyup.enter.native="handleQuery"/>
  17. </el-form-item>
  18. <el-form-item label="机构类型" prop="execOrgType">
  19. <el-select v-model="queryParams.execOrgType" placeholder="请选择培训机构类型" clearable>
  20. <el-option v-for="dict in dict.type.sys_org_type" :key="dict.value" :label="dict.label"
  21. :value="dict.value"/>
  22. </el-select>
  23. </el-form-item>
  24. <el-form-item label="任务状态" prop="planStatus">
  25. <el-select v-model="queryParams.planStatus" placeholder="请选择任务状态" clearable>
  26. <el-option v-for="dict in dict.type.edu_plan_status" :key="dict.value" :label="dict.label"
  27. :value="dict.value"/>
  28. </el-select>
  29. </el-form-item>
  30. <!-- <el-form-item label="培训角色" prop="planRoleId">
  31. <el-select v-model="queryParams.planRoleId" placeholder="请选择培训角色" clearable>
  32. <el-option v-for="item in planRoleList" :key="item.roleId" :label="item.roleName"
  33. :value="item.roleId"></el-option>
  34. </el-select>
  35. </el-form-item>-->
  36. <el-form-item label="任务周期" prop="planCycle">
  37. <el-select v-model="queryParams.planCycle" placeholder="请选择任务周期" clearable>
  38. <el-option v-for="dict in dict.type.edu_plan_cycle" :key="dict.value" :label="dict.label"
  39. :value="dict.value"/>
  40. </el-select>
  41. </el-form-item>
  42. <el-form-item>
  43. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  44. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  45. <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd"
  46. v-hasPermi="['core:plan:add']">新增任务
  47. </el-button>
  48. </el-form-item>
  49. </el-form>
  50. <el-row :gutter="10" class="mb8">
  51. <!-- <el-col :span="1.5">
  52. <el-button type="success" plain icon="el-icon-edit-outline" size="mini" :disabled="single" @click="handleUpdate"
  53. v-hasPermi="['core:plan:edit']">修改
  54. </el-button>
  55. </el-col>
  56. <el-col :span="1.5">
  57. <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
  58. v-hasPermi="['core:plan:remove']">删除
  59. </el-button>
  60. </el-col>
  61. <el-col :span="1.5">
  62. <el-button
  63. type="warning"
  64. plain
  65. icon="el-icon-download"
  66. size="mini"
  67. @click="handleExport"
  68. v-hasPermi="['core:plan:export']"
  69. >导出
  70. </el-button>
  71. </el-col>-->
  72. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  73. </el-row>
  74. <el-table
  75. border
  76. height="550"
  77. size="small" :data="planList" @selection-change="handleSelectionChange" row-key="id">
  78. <!-- :tree-props="{ children: 'children' }" -->
  79. <el-table-column label="序号" align="center" prop="no" width="60"/>
  80. <el-table-column label="培训主题" align="left" header-align="center" width="200" prop="planName"/>
  81. <el-table-column label="创建机构" align="left" header-align="center" width="180" prop="createOrgName"/>
  82. <el-table-column label="行社名称" align="left" header-align="center" width="180" prop="belongOrgName"/>
  83. <!-- <el-table-column label="所属机构" align="left" width="180" prop="belongOrgName"/> -->
  84. <el-table-column label="机构类型" align="center" width="180" prop="execOrgType">
  85. <template slot-scope="scope">
  86. <dict-tag :options="dict.type.sys_org_type" :value="scope.row.execOrgType"/>
  87. </template>
  88. </el-table-column>
  89. <!-- <el-table-column prop="planRoleNameList" width="180" label="培训角色">
  90. <template slot-scope="scope">
  91. <template v-if="scope.row.planRoleNameList">
  92. <el-tag size="mini" type="success"
  93. v-for="(item, index) in (scope.row.planRoleNameList || '').split(',')"
  94. :key="index">
  95. {{ item }}
  96. </el-tag>
  97. </template>
  98. <template v-else>
  99. <el-tag size="mini">{{ scope.row.checkOrgTypeText }}</el-tag>
  100. </template>
  101. </template>
  102. </el-table-column>-->
  103. <el-table-column label="任务周期" align="center" prop="planCycle">
  104. <template slot-scope="scope">
  105. <dict-tag :options="dict.type.edu_plan_cycle" :value="scope.row.planCycle"/>
  106. </template>
  107. </el-table-column>
  108. <el-table-column label="任务次数" align="center" prop="execTimes"/>
  109. <el-table-column label="任务状态" align="center" prop="planStatus">
  110. <template slot-scope="scope">
  111. <dict-tag :options="dict.type.edu_plan_status" :value="parseInt(scope.row.planStatus)"/>
  112. </template>
  113. </el-table-column>
  114. <el-table-column label="备注" align="center" prop="remark"/>
  115. <el-table-column label="操作" width="220" fixed="right" align="center" class-name="small-padding fixed-width">
  116. <template slot-scope="scope">
  117. <el-button v-if="checkCanPublish(scope.row)" size="mini" type="text" icon="el-icon-down"
  118. @click="handlePublish(scope.row)" v-hasPermi="['core:plan:edit']">下发
  119. </el-button>
  120. <el-button v-if="checkCanRevocation(scope.row)" size="mini" type="text" icon="el-icon-down"
  121. @click="handleRevocation(scope.row)" v-hasPermi="['core:plan:edit']">撤回
  122. </el-button>
  123. <el-button v-if="checkCanEdit(scope.row)" size="mini" type="text" icon="el-icon-edit-outline"
  124. @click="handleUpdate(scope.row)" v-hasPermi="['core:plan:edit']">编辑
  125. </el-button>
  126. <el-button v-if="checkCanDel(scope.row)" size="mini" type="text" icon="el-icon-delete"
  127. @click="handleDelete(scope.row)" v-hasPermi="['core:plan:remove']">删除
  128. </el-button>
  129. </template>
  130. </el-table-column>
  131. </el-table>
  132. <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
  133. :limit.sync="queryParams.pageSize"
  134. @pagination="getList"/>
  135. </el-col>
  136. </el-row>
  137. <!-- 添加或修改教育培训计划对话框 -->
  138. <DialogCom :title="title" :visible.sync="open" :before-close="closeDialog" @close="cancel" width="850px"
  139. height="800px" append-to-body>
  140. <el-form ref="form" :model="form" :rules="rules" label-width="110px">
  141. <el-row>
  142. <el-col :span="24">
  143. <el-form-item label="培训主题" prop="planName" class="endItem">
  144. <el-input v-model="form.planName" maxlength="50" placeholder="请输入培训主题"/>
  145. </el-form-item>
  146. </el-col>
  147. </el-row>
  148. <el-row>
  149. <el-col :span="12">
  150. <el-form-item label="任务周期" prop="planCycle">
  151. <el-select style="width: 100%" v-model="form.planCycle" placeholder="请选择任务周期">
  152. <el-option v-for="dict in dict.type.edu_plan_cycle" :key="dict.value" :label="dict.label"
  153. :value="parseInt(dict.value)"></el-option>
  154. </el-select>
  155. </el-form-item>
  156. </el-col>
  157. <el-col :span="12">
  158. <el-form-item label="任务次数" prop="execTimes">
  159. <template>
  160. <el-input-number style="width: 100%" v-model="form.execTimes" :min="1" :max="10"></el-input-number>
  161. </template>
  162. </el-form-item>
  163. </el-col>
  164. <!-- <el-col :span="12">
  165. <el-form-item label="培训角色" prop="planRoleId">
  166. <el-select style="width: 100%" v-model="form.planRoleId" placeholder="请选择" multiple>
  167. <el-option v-for="item in roleList" :key="item.id" :label="item.name" :value="item.id"></el-option>
  168. </el-select>
  169. </el-form-item>
  170. </el-col>-->
  171. </el-row>
  172. <el-row>
  173. <el-col :span="12" v-show="form.planCycle == 0">
  174. <el-form-item prop="startDate" label="开始日期">
  175. <el-date-picker v-model="form.startDate" @change="startDateChanged"
  176. :picker-options="startDatepickerOptions"
  177. align="right" type="date" placeholder="选择开始日期">
  178. </el-date-picker>
  179. </el-form-item>
  180. </el-col>
  181. <el-col :span="12" v-show="form.planCycle == 0">
  182. <el-form-item prop="endDate" label="结束日期">
  183. <el-date-picker style="width: 100%" v-model="form.endDate" :picker-options="endDatepickerOptions"
  184. align="right" type="date"
  185. placeholder="选择结束日期">
  186. </el-date-picker>
  187. </el-form-item>
  188. </el-col>
  189. </el-row>
  190. <el-row>
  191. <el-col :span="12" v-show="form.planCycle != 0">
  192. <el-form-item label="立即生效" prop="buildTaskNow">
  193. <el-checkbox v-model="form.buildTaskNow">
  194. 默认从下个周期生成任务,
  195. <br/>
  196. 勾选后从当前周期立即生成任务
  197. <!-- <el-popover placement="top-start" title="" width="200" trigger="hover"
  198. content="默认从下个周期生成任务,勾选后从当前周期立即生成任务">
  199. <i class="el-icon-warning-outline change-icon" slot="reference"></i>
  200. </el-popover>-->
  201. </el-checkbox>
  202. </el-form-item>
  203. </el-col>
  204. <el-col :span="12">
  205. <el-form-item label="受训机构类型" prop="execOrgType">
  206. <el-select style="width: 100%" v-model="form.execOrgType" placeholder="请选择受训机构类型"
  207. @change="execOrgTypeChanged()">
  208. <el-option v-for="dict in getUserOrgType" :key="dict.value" :label="dict.label"
  209. :value="parseInt(dict.value)"></el-option>
  210. </el-select>
  211. </el-form-item>
  212. </el-col>
  213. </el-row>
  214. <el-row>
  215. <!-- <el-col :span="12">
  216. <el-form-item v-if="this.form.id" label="计划状态" prop="planStatus">
  217. <el-select style="width: 100%" v-model="form.planStatus" placeholder="请选择计划状态">
  218. <el-option v-for="dict in dict.type.edu_plan_status" :key="dict.value" :label="dict.label"
  219. :value="parseInt(dict.value)"></el-option>
  220. </el-select>
  221. </el-form-item>
  222. </el-col>-->
  223. <el-col :span="24">
  224. <el-form-item v-show="form.execOrgType" label="受训机构" prop="planExecOrgIdList">
  225. <org-tree-select v-model="form.planExecOrgIdList" :queryData="form.execOrgType"
  226. ref="orgTreeSelect" :enabledCheckOrgTypes="form.execOrgType" :disable="true">
  227. </org-tree-select>
  228. </el-form-item>
  229. </el-col>
  230. </el-row>
  231. <el-row>
  232. <el-col :span="24">
  233. <el-form-item label="备注" prop="remark">
  234. <k-textarea v-model="form.remark" :length="200" :autosize="{ minRows: 2, maxRows: 4}" type="textarea"
  235. show-word-limit placeholder="请输入备注"/>
  236. </el-form-item>
  237. </el-col>
  238. </el-row>
  239. <el-row>
  240. <el-col :span="12">
  241. <el-form-item label="上传文件" prop="fileList">
  242. <K-file-upload ref="upload" :defaultValue="formFileListDefualtValue" v-model="form.fileList"/>
  243. </el-form-item>
  244. </el-col>
  245. <el-col :span="12">
  246. <el-form-item label="">
  247. <el-button type="primary" @click="showSelectFile">选取知识库文件</el-button>
  248. </el-form-item>
  249. </el-col>
  250. </el-row>
  251. </el-form>
  252. <div slot="footer" class="dialog-footer">
  253. <el-button type="primary" @click="submitForm">确 定</el-button>
  254. <el-button @click="cancel">取 消</el-button>
  255. </div>
  256. </DialogCom>
  257. <DialogSelectFile
  258. ref="DialogSelectFile"
  259. :defaultSelect=defaultSelect
  260. @select="fileSelected"
  261. :orgId="orgId"
  262. ></DialogSelectFile>
  263. </div>
  264. </template>
  265. <script>
  266. import {
  267. addPlan,
  268. delPlan,
  269. getPlan,
  270. listPlan,
  271. listPlanRole,
  272. publishPlan,
  273. roleList,
  274. updatePlan,
  275. revocationPlan
  276. } from "@/api/core/edu/plan";
  277. import OrgTreeSelect from '@/components/orgTreeSelect'
  278. import tableList from "@/mixins/tableList";
  279. import OrgTree from "@/components/orgTree";
  280. import {deptTreeSelect} from "@/api/system/public";
  281. import KFileUpload from "@/components/K-FileUpload/index.vue";
  282. import DialogSelectFile from "./dialog.select.file.vue";
  283. import dayjs from "dayjs";
  284. import KTextarea from "@/components/common/textarea.vue";
  285. export default {
  286. name: "Plan",
  287. dicts: ['sys_org_type', 'edu_plan_cycle', 'edu_plan_status'],
  288. components: {OrgTreeSelect, OrgTree, KFileUpload, DialogSelectFile,KTextarea},
  289. mixins: [tableList],
  290. data() {
  291. return {
  292. // 遮罩层
  293. loading: true,
  294. // 选中数组
  295. ids: [],
  296. // 非单个禁用
  297. single: true,
  298. // 非多个禁用
  299. multiple: true,
  300. // 显示搜索条件
  301. showSearch: true,
  302. // 总条数
  303. total: 0,
  304. // 教育培训计划表格数据
  305. planList: [],
  306. // 弹出层标题
  307. title: "",
  308. // 是否显示弹出层
  309. open: false,
  310. isUnfold: false,
  311. defaultSelect: [],
  312. filterOrtTypeOptions: [],
  313. orgId: null,
  314. type: null,
  315. // 查询参数
  316. queryParams: {
  317. execOrgType: null,
  318. planCycle: null,
  319. planStatus: null,
  320. planRoleId: null,
  321. planName: null,
  322. pageNum: 1,
  323. pageSize: 10,
  324. belongOrgId: null,
  325. checkSub: false
  326. },
  327. formFileListDefualtValue: [],
  328. // 表单参数
  329. form: {},
  330. // 表单校验
  331. rules: {
  332. planName: [
  333. {required: true, message: "培训主题不能为空", trigger: "blur"}
  334. ],
  335. planCycle: [
  336. {required: true, message: "计划周期不能为空", trigger: "blur"}
  337. ],
  338. execTimes: [
  339. {required: true, message: "培训次数不能为空", trigger: "blur"}
  340. ],
  341. planStatus: [
  342. {required: true, message: "计划状态不能为空", trigger: "blur"}
  343. ],
  344. execOrgType: [
  345. {required: true, message: "培训机构类型不能为空", trigger: "blur"}
  346. ],
  347. planRoleId: [
  348. {required: true, message: "培训角色不能为空", trigger: "blur"}
  349. ],
  350. },
  351. planRoleList: [],
  352. roleList: [],
  353. //修改新增中的机构树
  354. deptOptions: [],
  355. startDatepickerOptions: {
  356. disabledDate(time) {
  357. const date = new Date();
  358. date.setTime(date.getTime() - 3600 * 1000 * 24);
  359. return time.getTime() < date;
  360. },
  361. },
  362. endDatepickerOptions: {
  363. disabledDate: this.disabledDate,
  364. },
  365. };
  366. },
  367. computed: {
  368. getUserOrgType() {
  369. let tempArry = [];
  370. this.dict.type.sys_org_type.forEach(x => {
  371. if (Number(x.value) >= this.$store.getters.orgType) {
  372. tempArry.push(x);
  373. }
  374. });
  375. // console.log("computed getUserOrgType",tempArry);
  376. return tempArry;
  377. }
  378. },
  379. created() {
  380. this.getList();
  381. // this.initPlanRoleList();
  382. this.orgId = this.$store.getters.orgId;
  383. },
  384. methods: {
  385. // clear() {
  386. // this.$refs['orgTreeSelect'].clear();
  387. // },
  388. queryNode(nodes) {
  389. this.form.planExecOrgIdList = JSON.parse(nodes).map(v => {
  390. return v.id
  391. });
  392. },
  393. /** 查询教育培训计划列表 */
  394. getList() {
  395. this.loading = true;
  396. listPlan(this.queryParams).then(response => {
  397. this.planList = response.rows;
  398. this.total = response.total;
  399. this.loading = false;
  400. });
  401. },
  402. //初始化与计划相关的角色信息
  403. initPlanRoleList() {
  404. listPlanRole({}).then(response => {
  405. this.planRoleList = response.data;
  406. });
  407. },
  408. //初始化所有角色数据
  409. initRoleList(query) {
  410. this.form.planRoleId = [];
  411. roleList(query).then(response => {
  412. this.roleList = response.data;
  413. });
  414. },
  415. startDateChanged(time) {
  416. if (this.form.startDate > this.form.endDate) {
  417. this.form.endDate = this.form.startDate;
  418. }
  419. },
  420. disabledDate(time) {
  421. //小于开始日期禁止选择
  422. let startDate = new Date();
  423. startDate.setTime(startDate.getTime() - 3600 * 1000 * 24);
  424. if (this.form.startDate) {
  425. startDate = new Date(this.formatTime(this.form.startDate, 'YYYY-MM-DD'));
  426. startDate.setTime(startDate.getTime() - 3600 * 1000 * 24);
  427. }
  428. return time.getTime() < new Date(startDate).getTime()
  429. },
  430. checkCanPublish(row) {
  431. //是标准计划且未下发,状态为草稿或停用,且所属机构为当前用户登录机构时才显示 “下发”按钮
  432. if (row.issue == 0 && row.standard == 1 && (row.planStatus == 0 || row.planStatus == 2)&&this.checkCanEdit(row)) {
  433. return true
  434. }
  435. return false;
  436. },
  437. //撤回按钮
  438. checkCanRevocation(row) {
  439. return row.planStatus == 1 && row.standard == 1 && this.checkCanEdit(row);
  440. },
  441. //所属机构为当前用户登录机构或等于创建机构时才显示 “编辑、删除”按钮
  442. checkCanEdit(row) {
  443. return (row.belongOrgId == this.$store.getters.orgId || row.createOrgId == this.$store.getters.orgId)
  444. },
  445. checkCanDel(row) {
  446. // 计划仅能够通过删除标准计划来删除
  447. /* return (row.belongOrgId == this.$store.getters.orgId)
  448. /!* && (row.issue != 1 || (row.issue == 1 && row.done != 1))*!/
  449. && !row.parentId && row.createByTopOrg!=1*/
  450. return row.standard == 1 && row.done != 1 && this.checkCanEdit(row);
  451. },
  452. //省联社下发的计划不显示“删除”按钮
  453. checkCreateByTopOrg(row) {
  454. return row.createByTopOrg !== 1 && this.checkCanEdit(row);
  455. },
  456. execOrgTypeChanged(row) {
  457. this.$refs['orgTreeSelect'].clear();
  458. this.initRoleList(this.form.execOrgType);
  459. // this.form.planExecOrgIdList = [];
  460. },
  461. /** 查询机构树数据 */
  462. getDeptTree() {
  463. deptTreeSelect().then(response => {
  464. this.deptOptions = response.data;
  465. });
  466. },
  467. // 取消按钮
  468. cancel() {
  469. //console.log("xxx")
  470. this.open = false;
  471. this.reset();
  472. this.$refs['orgTreeSelect'].clear();
  473. this.$refs["upload"].clearFiles();
  474. },
  475. closeDialog() {
  476. this.cancel();
  477. },
  478. // 表单重置
  479. reset() {
  480. this.form = {
  481. id: null,
  482. planName: null,
  483. planCycle: null,
  484. execTimes: null,
  485. planStatus: null,
  486. execOrgType: null,
  487. planExecOrgIdList: [],
  488. startDate: null,
  489. endDate: null,
  490. buildTaskNow: null,
  491. remark: null,
  492. planRoleId: null,
  493. fileList: null
  494. };
  495. this.resetForm("form");
  496. },
  497. getDefaultKey(key) {
  498. this.queryParams.belongOrgId = key;
  499. this.getList();
  500. },
  501. //单选框状态改变
  502. checkChange(state) {
  503. this.queryParams.checkSub = state;
  504. this.handleQuery();
  505. },
  506. // 节点单击事件
  507. clickTreeNode(data) {
  508. // this.initPlanRoleList();
  509. this.queryParams.belongOrgId = data.id;
  510. this.handleQuery();
  511. },
  512. /** treeSelect组件自定义数据*/
  513. tenantIdnormalizer(node, instanceId) {
  514. if (node.children && !node.children.length) {
  515. delete node.children
  516. }
  517. return {
  518. id: node.id,
  519. label: node.name,
  520. children: node.children
  521. }
  522. },
  523. /** 搜索按钮操作 */
  524. handleQuery() {
  525. this.queryParams.pageNum = 1;
  526. this.getList();
  527. },
  528. /** 重置按钮操作 */
  529. resetQuery() {
  530. this.resetForm("queryForm");
  531. this.handleQuery();
  532. },
  533. // 多选框选中数据
  534. handleSelectionChange(selection) {
  535. this.ids = selection.map(item => item.id)
  536. this.single = selection.length !== 1
  537. this.multiple = !selection.length
  538. },
  539. /** 新增按钮操作 */
  540. handleAdd() {
  541. this.initRoleList();
  542. this.reset();
  543. this.open = true;
  544. this.title = "新增培训任务";
  545. },
  546. /** 修改按钮操作 */
  547. handleUpdate(row) {
  548. this.initRoleList();
  549. this.reset();
  550. const id = row.id || this.ids
  551. getPlan(id).then(response => {
  552. this.form = response.data;
  553. //将 this.form.planExecOrgIdList中的元素转为字符串
  554. if (this.form.planExecOrgIdList == null) {
  555. this.form.planExecOrgIdList = [];
  556. }
  557. this.form.planExecOrgIdList = this.form.planExecOrgIdList.map(element => element.toString());
  558. this.formFileListDefualtValue = this.form.fileList;
  559. this.open = true;
  560. this.title = "修改培训任务";
  561. });
  562. },
  563. /** 提交按钮 */
  564. submitForm() {
  565. if (dayjs(this.form.startDate).isAfter(dayjs(this.form.endDate))) {
  566. this.$message.error("开始时间不能大于结束时间!");
  567. return;
  568. }
  569. this.$refs["form"].validate(valid => {
  570. if (valid) {
  571. let request = {...this.form};
  572. if (this.form.planExecOrgIdList) {
  573. const list = Array.isArray(this.form.planExecOrgIdList) ? this.form.planExecOrgIdList : [this.form.planExecOrgIdList];
  574. request.planExecOrgIdList = list;
  575. } else {
  576. request.planExecOrgIdList = [];
  577. }
  578. if (request.id != null) {
  579. console.log("updatePlan", request)
  580. this.$modal.confirm(this.getMsgStr(request, '修改')).then(function () {
  581. return updatePlan(request);
  582. }).then(() => {
  583. this.$modal.msgSuccess("修改成功");
  584. this.open = false;
  585. this.getList();
  586. }).catch(() => {
  587. });
  588. } else {
  589. addPlan(request).then(response => {
  590. this.$modal.msgSuccess("新增成功");
  591. this.open = false;
  592. this.getList();
  593. });
  594. }
  595. }
  596. });
  597. },
  598. /** 删除按钮操作 */
  599. handleDelete(row) {
  600. const ids = row.id || this.ids;
  601. this.$modal.confirm(this.getMsgStr(row, '删除')).then(function () {
  602. return delPlan(ids);
  603. }).then(() => {
  604. this.getList();
  605. this.$modal.msgSuccess("删除成功");
  606. }).catch(() => {
  607. });
  608. },
  609. /** 下发计划 */
  610. handlePublish(row) {
  611. if (row.id != null) {
  612. this.$modal.confirm(this.getMsgStr(row, '下发')).then(function () {
  613. return publishPlan(row.id);
  614. }).then(() => {
  615. this.$modal.msgSuccess("计划下发成功");
  616. this.getList();
  617. }).catch(() => {
  618. });
  619. }
  620. },
  621. getMsgStr(row, type) {
  622. let str = '是否确认' + type + '该计划?';
  623. if (row.standard == 1) {
  624. str = '此操作将会影响所有行社计划,' + str;
  625. }
  626. return str;
  627. },
  628. //撤回计划
  629. handleRevocation(row) {
  630. if (row.id != null) {
  631. this.$modal.confirm('撤回计划会清除本周期所有任务,是否继续?').then(function () {
  632. return revocationPlan(row.id);
  633. }).then(() => {
  634. this.$modal.msgSuccess("计划撤回成功");
  635. this.getList();
  636. }).catch(() => {
  637. });
  638. }
  639. },
  640. /** 导出按钮操作 */
  641. handleExport() {
  642. this.download('system/plan/export', {
  643. ...this.queryParams
  644. }, `plan_${new Date().getTime()}.xlsx`)
  645. },
  646. showSelectFile() {
  647. this.$refs["DialogSelectFile"].show();
  648. },
  649. fileSelected(list) {
  650. if (!list) return;
  651. let tempArry = [];
  652. list.forEach(x => {
  653. tempArry = tempArry.concat(x.fileList);
  654. })
  655. console.log("tempArry", tempArry, this.form.fileList);
  656. if (this.form.fileList) {
  657. this.formFileListDefualtValue = this.form.fileList.concat(tempArry);
  658. } else {
  659. this.formFileListDefualtValue = tempArry;
  660. }
  661. },
  662. },
  663. mounted() {
  664. // console.log("mounted",this.$options.dicts);
  665. // let a= this.getSysOrgType;
  666. // console.log(" handleAdd getSysOrgType",a);
  667. },
  668. // updated(){
  669. // console.log("update",this.$options.dicts);
  670. // },
  671. };
  672. </script>
  673. <style lang="scss" scoped>
  674. .endItem ::v-deep .el-textarea__inner {
  675. padding-bottom: 36px;
  676. }
  677. </style>