officialAccountadd.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599
  1. <template>
  2. <div>
  3. <div class="container">
  4. <el-form :model="infolist" ref="infolist" :rules="rules" class="container-box">
  5. <h2 style="display: block;margin-bottom: 20px;">公众号图文协推资料发起</h2>
  6. <div style="height: calc(100% - 160px);overflow-y: scroll;">
  7. <div class="info-line">
  8. <el-form-item prop="taskName">
  9. <span>任务名称</span>
  10. <el-input v-model="infolist.taskName" placeholder="任务名称" :disabled="disableStatus">
  11. </el-input>
  12. </el-form-item>
  13. <el-form-item>
  14. <span>推送渠道</span>
  15. <el-input v-model="infolist.channel" placeholder="推送渠道" :disabled="disableStatus">
  16. </el-input>
  17. </el-form-item>
  18. <el-form-item>
  19. <span>推送时间</span>
  20. <el-date-picker v-model="infolist.time" type="date" placeholder="推送时间">
  21. </el-date-picker>
  22. </el-form-item>
  23. <el-form-item>
  24. <span>推送标题</span>
  25. <el-input v-model="infolist.tit" placeholder="推送标题" :disabled="disableStatus"></el-input>
  26. </el-form-item>
  27. <el-form-item>
  28. <span>推送摘要</span>
  29. <el-input v-model="infolist.pushAbstract" placeholder="推送摘要" :disabled="disableStatus">
  30. </el-input>
  31. </el-form-item>
  32. <el-form-item>
  33. <span>原文链接</span>
  34. <el-input v-model="infolist.original" placeholder="原文链接" :disabled="disableStatus">
  35. </el-input>
  36. </el-form-item>
  37. </div>
  38. <el-form-item prop="regionCode" class="info-line online">
  39. <span>落实单位</span>
  40. <el-select :popper-append-to-body="false" v-model="infolist.compList" placeholder="落实单位"
  41. multiple @change="chocomp">
  42. <el-option v-for="(item,index) in regionOpt" :key="index" :label="item.l"
  43. :value="item.o">
  44. </el-option>
  45. </el-select>
  46. </el-form-item>
  47. <el-form-item class="info-line online">
  48. <span>任务说明</span>
  49. <el-input v-model="infolist.remark" placeholder="任务说明" type="textarea" :rows="3"></el-input>
  50. </el-form-item>
  51. <div style="padding-left: 80px">
  52. <myUpload @uploadBack="uploadBack" :fileInfo="fileInfo" :fileList="fileInfo.fileList">
  53. </myUpload>
  54. </div>
  55. </div>
  56. <div class="t-footer">
  57. <el-button type="primary" @click="temp">保 存</el-button>
  58. <el-button type="primary" @click="checkexa = true">确 定</el-button>
  59. <el-button @click="dialogCli(1)">取 消</el-button>
  60. </div>
  61. </el-form>
  62. </div>
  63. <!-- <el-dialog title="选择审批人" :visible.sync="checkexa" width="50%" :destroy-on-close="true"
  64. :modal-append-to-body="false" :close-on-click-modal="false">
  65. <div>
  66. <el-form :model="infolist" ref="infolist" :rules="rules">
  67. <el-form-item prop="visiblec" class="info-line online">
  68. <span>审批人员</span>
  69. <deptTreeOnly class="tree" @treeCheck="treeCheckonly" :defaultList="defaultList"
  70. :type="depttype" :closeList="closeList"></deptTreeOnly>
  71. <div class="tree treeUser">
  72. <p>{{treeListonly.leaderAuditName}}
  73. <i v-if="treeListonly.leaderAuditName" @click="deletes()"
  74. class="el-icon-error"></i>
  75. </p>
  76. </div>
  77. </el-form-item>
  78. </el-form>
  79. <div slot="footer" style="text-align: right;">
  80. <el-button type="primary" @click="dialogCli(2)">确 定</el-button>
  81. <el-button @click="checkexa = false">取 消</el-button>
  82. </div>
  83. </div>
  84. </el-dialog> -->
  85. <el-dialog
  86. title="选择审批人"
  87. :visible.sync="checkexa"
  88. width="100%"
  89. style="height: 100%"
  90. :fullscreen="true"
  91. :destroy-on-close="true"
  92. :modal-append-to-body="false"
  93. :close-on-click-modal="false"
  94. >
  95. <div style="height: 100%">
  96. <el-form :model="infolist" ref="infolist" style="height: 100%">
  97. <el-form-item prop="visiblec" style="height: 100%">
  98. <!-- <span style="width: 80px">审批人员</span> -->
  99. <deptTreeOnly
  100. @treeCheck="treeCheckonly"
  101. :defaultList="defaultList"
  102. :type="depttype"
  103. :closeList="closeList"
  104. ></deptTreeOnly>
  105. <div style="text-align: center; margin-top: 30px">
  106. <el-button type="primary" @click="checkProcessUser()"
  107. >确 定</el-button
  108. >
  109. <el-button @click="checkexa = false">取 消</el-button>
  110. </div>
  111. </el-form-item>
  112. </el-form>
  113. </div>
  114. </el-dialog>
  115. </div>
  116. </template>
  117. <script>
  118. import mySearch from "../../../components/search.vue";
  119. import myUpload from "../../../components/upload.vue";
  120. // import deptTreeOnly from "../../../components/deptTreeOnly.vue"
  121. import deptTreeOnly from "../../../components/newTree.vue";
  122. export default {
  123. components: {
  124. mySearch,
  125. myUpload,
  126. deptTreeOnly
  127. },
  128. data() {
  129. const taskName = (rule, value, callback) => {
  130. if (!this.infolist.taskName) {
  131. callback(new Error('不能为空'))
  132. } else {
  133. callback()
  134. }
  135. }
  136. return {
  137. rules: {
  138. taskName: [{
  139. required: true,
  140. trigger: 'blur',
  141. validator: taskName
  142. }],
  143. },
  144. fullscreen: false,
  145. tableData: [{}],
  146. disableStatus: false,
  147. infolist: {},
  148. terminal: '',
  149. userInfo: {},
  150. params: {},
  151. attList: [],
  152. //
  153. options: [],
  154. regionOpt: [],
  155. fileInfo: {
  156. limit: 5,
  157. url: '/market/cmkAttachInfo/mkEmscnpl/upload',
  158. fileList: []
  159. },
  160. company: [],
  161. checkexa: false,
  162. treeListonly: {},
  163. defaultList: [],
  164. closeList: false,
  165. depttype: 0,
  166. tempSave: false,
  167. }
  168. },
  169. methods: {
  170. checkProcessUser() {
  171. let _this = this;
  172. if (_this.treeListonly.length > 1) {
  173. _this.$message({
  174. message: "只能选择一个人",
  175. type: "error",
  176. });
  177. } else {
  178. _this.dialogCli(2);
  179. }
  180. },
  181. deletes() {
  182. this.treeListonly = {};
  183. this.closeList = !this.closeList;
  184. },
  185. treeCheckonly(v) {
  186. this.treeListonly = v;
  187. this.treeListonly.leaderAuditName = v[0].label;
  188. this.treeListonly.leaderAuditNo = v[0].key;
  189. },
  190. chocomp(v) {
  191. this.company = [];
  192. if(v[v.length-1] == '全选'){
  193. this.infolist.compList = [];
  194. for (let i = 0; i < this.regionOpt.length; i++) {
  195. if (this.regionOpt[i].o != '全选') {
  196. let x = {};
  197. x.approvalNo = '';
  198. x.approvalName = '';
  199. x.deptNo = this.regionOpt[i].o;
  200. x.compName = this.regionOpt[i].l;
  201. this.company.push(x);
  202. this.infolist.compList.push(this.regionOpt[i].o)
  203. }
  204. }
  205. }else{
  206. for (let i = 0; i < this.regionOpt.length; i++) {
  207. for (let j = 0; j < v.length; j++) {
  208. if (this.regionOpt[i].o == v[j]) {
  209. let x = {};
  210. x.approvalNo = '';
  211. x.approvalName = '';
  212. x.deptNo = this.regionOpt[i].o;
  213. x.compName = this.regionOpt[i].l;
  214. this.company.push(x)
  215. }
  216. }
  217. }
  218. }
  219. },
  220. //添加
  221. dialogCli(v) {
  222. if (v === 1) {
  223. this.fileInfo.fileList = [];
  224. this.infolist = {};
  225. this.checkexa = false;
  226. return
  227. }
  228. let _this = this;
  229. let info = {};
  230. this.infolist.time = this.infolist.time?_this.$formatDate(this.infolist.time, "YYYY-MM-DD"):'';
  231. this.infolist.opTime = _this.$formatDate(new Date(), "YYYY-MM-DD");
  232. this.infolist.opNo = this.userInfo.loginNo;
  233. this.infolist.opName = this.userInfo.loginName;
  234. this.infolist.compList = this.company;
  235. this.infolist.directorNo = this.treeListonly.leaderAuditNo;
  236. this.infolist.directorName = this.treeListonly.leaderAuditName;
  237. this.infolist.attList = this.attList;
  238. this.infolist.sts = '1';
  239. this.infolist.stsDesc = '待审核';
  240. this.submitInfo("/market/cemscnpl/add");
  241. this.$http({
  242. url: "/market/bpmTemp/del",
  243. method: "post",
  244. headers: {
  245. "Content-Type": "application/json",
  246. },
  247. data: {
  248. bpmType: "2",
  249. },
  250. }).then((res) => {
  251. //console.log(res)
  252. });
  253. },
  254. submitInfo(u, v) {
  255. let _this = this;
  256. this.$refs.infolist.validate(valid => {
  257. if (valid) {
  258. this.$http({
  259. url: u,
  260. method: "post",
  261. headers: {
  262. "Content-Type": "application/json",
  263. },
  264. data: this.infolist,
  265. }).then((res) => {
  266. if (res.data.result === 1) {
  267. _this.$message({
  268. message: res.data.desc,
  269. type: 'error'
  270. });
  271. } else {
  272. _this.$message({
  273. message: '成功',
  274. type: 'success'
  275. });
  276. _this.dialogCli(1);
  277. }
  278. });
  279. }
  280. })
  281. },
  282. getUser() {
  283. this.userInfo = JSON.parse(window.sessionStorage.userInfo);
  284. },
  285. uploadBack(v) {
  286. this.attList = v;
  287. },
  288. getRegion() {
  289. this.$http({
  290. url: "/sysmgr/sysdept/queryList",
  291. method: "post",
  292. headers: {
  293. "Content-Type": "application/json",
  294. },
  295. data: {
  296. "initials":"市场经营部",
  297. "orglevel": "2"
  298. },
  299. }).then((res) => {
  300. this.regionOpt = res.data;
  301. this.regionOpt.unshift({
  302. l:'全选',
  303. o:'全选',
  304. })
  305. });
  306. },
  307. temp() {
  308. if (JSON.stringify(this.infolist)=='{}') {
  309. return;
  310. }
  311. let params = {};
  312. params.infolist = this.infolist
  313. params.fileList = [];
  314. params.attList = [];
  315. this.attList.forEach(item => {
  316. let file = {
  317. id: item.fileCode,
  318. fileCode: item.fileCode,
  319. fileName: item.fileName,
  320. name: item.fileName
  321. };
  322. params.fileList.push(file);
  323. params.attList.push(file);
  324. });
  325. this.$http({
  326. url: "/market/bpmTemp/temp",
  327. method: "post",
  328. headers: {
  329. "Content-Type": "application/json",
  330. },
  331. data: {
  332. bpmType: "2",
  333. content: JSON.stringify(params),
  334. },
  335. }).then((res) => {
  336. //console.log(res)
  337. });
  338. },
  339. },
  340. watch:{
  341. tempSave (value) {
  342. if (value) {
  343. // 监听编辑状态,每20秒请求一次,注意函数不加()
  344. this.timer = window.setInterval(this.temp, 20000)
  345. } else {
  346. // 停止监听
  347. clearInterval(this.timer)
  348. }
  349. }
  350. },
  351. mounted() {
  352. this.getUser();
  353. this.getRegion();
  354. this.$http({
  355. url: '/market/bpmTemp/query',
  356. method: "post",
  357. headers: {"Content-Type": "application/json",},
  358. data: {bpmType: "2"},
  359. }).then((res) => {
  360. if (res.data) {
  361. let content = JSON.parse(res.data.content);
  362. this.infolist = content.infolist;
  363. this.attList = content.attList;
  364. this.fileInfo.fileList = content.fileList;
  365. }
  366. this.tempSave = true;
  367. });
  368. },
  369. created() {
  370. }
  371. }
  372. </script>
  373. <style scoped lang="scss">
  374. ::v-deep .el-dialog .flex-box{
  375. height: 400px;
  376. }
  377. .img-box {
  378. height: calc(100vh - 240px);
  379. overflow-y: scroll;
  380. .boximg {
  381. display: flex;
  382. flex-wrap: wrap;
  383. margin-top: 20px;
  384. div {
  385. display: inline-block;
  386. width: 18%;
  387. margin-right: 2%;
  388. margin-bottom: 20px;
  389. overflow: hidden;
  390. border: 1px solid #ddd;
  391. border-radius: 3px;
  392. background: #fff;
  393. position: relative;
  394. height: 100px;
  395. img {
  396. width: 100%;
  397. position: absolute;
  398. top: 0;
  399. bottom: 0;
  400. margin: auto;
  401. // height: 100%;
  402. }
  403. }
  404. }
  405. }
  406. .boximgc {
  407. display: flex;
  408. flex-wrap: wrap;
  409. width: calc(100% - 80px) !important;
  410. margin-left: 80px;
  411. div {
  412. display: inline-block;
  413. width: 18% !important;
  414. margin-right: 2%;
  415. margin-bottom: 20px;
  416. overflow: hidden;
  417. border: 1px solid #ddd;
  418. border-radius: 3px;
  419. background: #fff;
  420. position: relative;
  421. height: 100px;
  422. img {
  423. width: 100%;
  424. position: absolute;
  425. top: 0;
  426. bottom: 0;
  427. margin: auto;
  428. // height: 100%;
  429. }
  430. }
  431. }
  432. .typebox {
  433. div {
  434. border: 1px solid #ddd;
  435. border-top: transparent;
  436. span {
  437. display: inline-block;
  438. width: 20%;
  439. line-height: 30px;
  440. padding: 10px;
  441. vertical-align: top;
  442. }
  443. .big {
  444. width: 35%;
  445. // background: #f4f4f4;
  446. }
  447. .small {
  448. width: 5%;
  449. text-align: center;
  450. // border-right: 1px solid #ddd;
  451. }
  452. .gys {
  453. width: 40%;
  454. }
  455. }
  456. }
  457. .t-footer {
  458. text-align: right;
  459. padding-right: 20px;
  460. margin-top: 20px;
  461. }
  462. .onetab {
  463. padding: 20px;
  464. height: calc(100% - 180px);
  465. }
  466. .titbox {
  467. div {
  468. float: right;
  469. i {
  470. font-size: 22px;
  471. margin-left: 20px;
  472. cursor: pointer;
  473. }
  474. }
  475. }
  476. .tabbox {
  477. margin-top: 15px;
  478. }
  479. .pageBox {
  480. text-align: right;
  481. margin-top: 10px;
  482. }
  483. .info-line {
  484. width: 100%;
  485. display: block;
  486. padding-left: 20px;
  487. div {
  488. width: 50%;
  489. display: inline-block;
  490. }
  491. span {
  492. width: 80px;
  493. display: inline-block;
  494. text-align: left;
  495. i {
  496. color: red;
  497. display: inline-block;
  498. padding-right: 5px;
  499. }
  500. }
  501. .el-select,
  502. .el-input {
  503. width: calc(100% - 100px);
  504. }
  505. }
  506. .online {
  507. width: 100%;
  508. .el-select {
  509. width: calc(100% - 100px);
  510. }
  511. span {
  512. vertical-align: top;
  513. }
  514. .el-textarea {
  515. width: calc(100% - 100px);
  516. }
  517. .tree {
  518. width: calc(50% - 60px);
  519. display: inline-block;
  520. margin-right: 20px;
  521. height: 300px;
  522. overflow-y: scroll;
  523. .el-icon-error {
  524. float: right;
  525. font-size: 20px;
  526. margin-top: 9px;
  527. cursor: pointer;
  528. }
  529. }
  530. .treeUser {
  531. margin: 0;
  532. border: 1px solid #ddd;
  533. p {
  534. background: #f4f4f4;
  535. padding: 0 20px;
  536. margin-bottom: 5px;
  537. }
  538. }
  539. .treeUserb {
  540. width: calc(100% - 100px);
  541. border: 1px solid #ddd;
  542. background: #f4f4f4;
  543. border-radius: 3px;
  544. height: auto;
  545. overflow: hidden;
  546. p {
  547. display: inline-block;
  548. padding: 0 20px;
  549. margin-bottom: 5px;
  550. }
  551. }
  552. }
  553. </style>