index.vue 25 KB

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