officialAccountadd.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552
  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. </div>
  86. </template>
  87. <script>
  88. import mySearch from "../../../components/search.vue";
  89. import myUpload from "../../../components/upload.vue";
  90. import deptTreeOnly from "../../../components/deptTreeOnly.vue"
  91. export default {
  92. components: {
  93. mySearch,
  94. myUpload,
  95. deptTreeOnly
  96. },
  97. data() {
  98. const taskName = (rule, value, callback) => {
  99. if (!this.infolist.taskName) {
  100. callback(new Error('不能为空'))
  101. } else {
  102. callback()
  103. }
  104. }
  105. return {
  106. rules: {
  107. taskName: [{
  108. required: true,
  109. trigger: 'blur',
  110. validator: taskName
  111. }],
  112. },
  113. fullscreen: false,
  114. tableData: [{}],
  115. disableStatus: false,
  116. infolist: {},
  117. terminal: '',
  118. userInfo: {},
  119. params: {},
  120. attList: [],
  121. //
  122. options: [],
  123. regionOpt: [],
  124. fileInfo: {
  125. limit: 5,
  126. url: '/market/cmkAttachInfo/mkEmscnpl/upload',
  127. fileList: []
  128. },
  129. company: [],
  130. checkexa: false,
  131. treeListonly: {},
  132. defaultList: [],
  133. closeList: false,
  134. depttype: 0,
  135. tempSave: false,
  136. }
  137. },
  138. methods: {
  139. deletes() {
  140. this.treeListonly = {};
  141. this.closeList = !this.closeList;
  142. },
  143. treeCheckonly(v) {
  144. this.treeListonly = v;
  145. },
  146. chocomp(v) {
  147. this.company = [];
  148. if(v[v.length-1] == '全选'){
  149. this.infolist.compList = [];
  150. for (let i = 0; i < this.regionOpt.length; i++) {
  151. if (this.regionOpt[i].o != '全选') {
  152. let x = {};
  153. x.approvalNo = '';
  154. x.approvalName = '';
  155. x.deptNo = this.regionOpt[i].o;
  156. x.compName = this.regionOpt[i].l;
  157. this.company.push(x);
  158. this.infolist.compList.push(this.regionOpt[i].o)
  159. }
  160. }
  161. }else{
  162. for (let i = 0; i < this.regionOpt.length; i++) {
  163. for (let j = 0; j < v.length; j++) {
  164. if (this.regionOpt[i].o == v[j]) {
  165. let x = {};
  166. x.approvalNo = '';
  167. x.approvalName = '';
  168. x.deptNo = this.regionOpt[i].o;
  169. x.compName = this.regionOpt[i].l;
  170. this.company.push(x)
  171. }
  172. }
  173. }
  174. }
  175. },
  176. //添加
  177. dialogCli(v) {
  178. if (v === 1) {
  179. this.fileInfo.fileList = [];
  180. this.infolist = {};
  181. this.checkexa = false;
  182. return
  183. }
  184. let _this = this;
  185. let info = {};
  186. this.infolist.time = this.infolist.time?_this.$formatDate(this.infolist.time, "YYYY-MM-DD"):'';
  187. this.infolist.opTime = _this.$formatDate(new Date(), "YYYY-MM-DD");
  188. this.infolist.opNo = this.userInfo.loginNo;
  189. this.infolist.opName = this.userInfo.loginName;
  190. this.infolist.compList = this.company;
  191. this.infolist.directorNo = this.treeListonly.leaderAuditNo;
  192. this.infolist.directorName = this.treeListonly.leaderAuditName;
  193. this.infolist.attList = this.attList;
  194. this.infolist.sts = '1';
  195. this.infolist.stsDesc = '待审核';
  196. this.submitInfo("/market/cemscnpl/add");
  197. this.$http({
  198. url: "/market/bpmTemp/del",
  199. method: "post",
  200. headers: {
  201. "Content-Type": "application/json",
  202. },
  203. data: {
  204. bpmType: "2",
  205. },
  206. }).then((res) => {
  207. //console.log(res)
  208. });
  209. },
  210. submitInfo(u, v) {
  211. let _this = this;
  212. this.$refs.infolist.validate(valid => {
  213. if (valid) {
  214. this.$http({
  215. url: u,
  216. method: "post",
  217. headers: {
  218. "Content-Type": "application/json",
  219. },
  220. data: this.infolist,
  221. }).then((res) => {
  222. if (res.data.result === 1) {
  223. _this.$message({
  224. message: res.data.desc,
  225. type: 'error'
  226. });
  227. } else {
  228. _this.$message({
  229. message: '成功',
  230. type: 'success'
  231. });
  232. _this.dialogCli(1);
  233. }
  234. });
  235. }
  236. })
  237. },
  238. getUser() {
  239. this.userInfo = JSON.parse(window.sessionStorage.userInfo);
  240. },
  241. uploadBack(v) {
  242. this.attList = v;
  243. },
  244. getRegion() {
  245. this.$http({
  246. url: "/sysmgr/sysdept/queryList",
  247. method: "post",
  248. headers: {
  249. "Content-Type": "application/json",
  250. },
  251. data: {
  252. "initials":"市场经营部",
  253. "orglevel": "2"
  254. },
  255. }).then((res) => {
  256. this.regionOpt = res.data;
  257. this.regionOpt.unshift({
  258. l:'全选',
  259. o:'全选',
  260. })
  261. });
  262. },
  263. temp() {
  264. if (JSON.stringify(this.infolist)=='{}') {
  265. return;
  266. }
  267. let params = {};
  268. params.infolist = this.infolist
  269. params.fileList = [];
  270. params.attList = [];
  271. this.attList.forEach(item => {
  272. let file = {
  273. id: item.fileCode,
  274. fileCode: item.fileCode,
  275. fileName: item.fileName,
  276. name: item.fileName
  277. };
  278. params.fileList.push(file);
  279. params.attList.push(file);
  280. });
  281. this.$http({
  282. url: "/market/bpmTemp/temp",
  283. method: "post",
  284. headers: {
  285. "Content-Type": "application/json",
  286. },
  287. data: {
  288. bpmType: "2",
  289. content: JSON.stringify(params),
  290. },
  291. }).then((res) => {
  292. //console.log(res)
  293. });
  294. },
  295. },
  296. watch:{
  297. tempSave (value) {
  298. if (value) {
  299. // 监听编辑状态,每20秒请求一次,注意函数不加()
  300. this.timer = window.setInterval(this.temp, 20000)
  301. } else {
  302. // 停止监听
  303. clearInterval(this.timer)
  304. }
  305. }
  306. },
  307. mounted() {
  308. this.getUser();
  309. this.getRegion();
  310. this.$http({
  311. url: '/market/bpmTemp/query',
  312. method: "post",
  313. headers: {"Content-Type": "application/json",},
  314. data: {bpmType: "2"},
  315. }).then((res) => {
  316. if (res.data) {
  317. let content = JSON.parse(res.data.content);
  318. this.infolist = content.infolist;
  319. this.attList = content.attList;
  320. this.fileInfo.fileList = content.fileList;
  321. }
  322. this.tempSave = true;
  323. });
  324. },
  325. created() {
  326. }
  327. }
  328. </script>
  329. <style scoped lang="scss">
  330. .img-box {
  331. height: calc(100vh - 240px);
  332. overflow-y: scroll;
  333. .boximg {
  334. display: flex;
  335. flex-wrap: wrap;
  336. margin-top: 20px;
  337. div {
  338. display: inline-block;
  339. width: 18%;
  340. margin-right: 2%;
  341. margin-bottom: 20px;
  342. overflow: hidden;
  343. border: 1px solid #ddd;
  344. border-radius: 3px;
  345. background: #fff;
  346. position: relative;
  347. height: 100px;
  348. img {
  349. width: 100%;
  350. position: absolute;
  351. top: 0;
  352. bottom: 0;
  353. margin: auto;
  354. // height: 100%;
  355. }
  356. }
  357. }
  358. }
  359. .boximgc {
  360. display: flex;
  361. flex-wrap: wrap;
  362. width: calc(100% - 80px) !important;
  363. margin-left: 80px;
  364. div {
  365. display: inline-block;
  366. width: 18% !important;
  367. margin-right: 2%;
  368. margin-bottom: 20px;
  369. overflow: hidden;
  370. border: 1px solid #ddd;
  371. border-radius: 3px;
  372. background: #fff;
  373. position: relative;
  374. height: 100px;
  375. img {
  376. width: 100%;
  377. position: absolute;
  378. top: 0;
  379. bottom: 0;
  380. margin: auto;
  381. // height: 100%;
  382. }
  383. }
  384. }
  385. .typebox {
  386. div {
  387. border: 1px solid #ddd;
  388. border-top: transparent;
  389. span {
  390. display: inline-block;
  391. width: 20%;
  392. line-height: 30px;
  393. padding: 10px;
  394. vertical-align: top;
  395. }
  396. .big {
  397. width: 35%;
  398. // background: #f4f4f4;
  399. }
  400. .small {
  401. width: 5%;
  402. text-align: center;
  403. // border-right: 1px solid #ddd;
  404. }
  405. .gys {
  406. width: 40%;
  407. }
  408. }
  409. }
  410. .t-footer {
  411. text-align: right;
  412. padding-right: 20px;
  413. margin-top: 20px;
  414. }
  415. .onetab {
  416. padding: 20px;
  417. height: calc(100% - 180px);
  418. }
  419. .titbox {
  420. div {
  421. float: right;
  422. i {
  423. font-size: 22px;
  424. margin-left: 20px;
  425. cursor: pointer;
  426. }
  427. }
  428. }
  429. .tabbox {
  430. margin-top: 15px;
  431. }
  432. .pageBox {
  433. text-align: right;
  434. margin-top: 10px;
  435. }
  436. .info-line {
  437. width: 100%;
  438. display: block;
  439. padding-left: 20px;
  440. div {
  441. width: 50%;
  442. display: inline-block;
  443. }
  444. span {
  445. width: 80px;
  446. display: inline-block;
  447. text-align: left;
  448. i {
  449. color: red;
  450. display: inline-block;
  451. padding-right: 5px;
  452. }
  453. }
  454. .el-select,
  455. .el-input {
  456. width: calc(100% - 100px);
  457. }
  458. }
  459. .online {
  460. width: 100%;
  461. .el-select {
  462. width: calc(100% - 100px);
  463. }
  464. span {
  465. vertical-align: top;
  466. }
  467. .el-textarea {
  468. width: calc(100% - 100px);
  469. }
  470. .tree {
  471. width: calc(50% - 60px);
  472. display: inline-block;
  473. margin-right: 20px;
  474. height: 300px;
  475. overflow-y: scroll;
  476. .el-icon-error {
  477. float: right;
  478. font-size: 20px;
  479. margin-top: 9px;
  480. cursor: pointer;
  481. }
  482. }
  483. .treeUser {
  484. margin: 0;
  485. border: 1px solid #ddd;
  486. p {
  487. background: #f4f4f4;
  488. padding: 0 20px;
  489. margin-bottom: 5px;
  490. }
  491. }
  492. .treeUserb {
  493. width: calc(100% - 100px);
  494. border: 1px solid #ddd;
  495. background: #f4f4f4;
  496. border-radius: 3px;
  497. height: auto;
  498. overflow: hidden;
  499. p {
  500. display: inline-block;
  501. padding: 0 20px;
  502. margin-bottom: 5px;
  503. }
  504. }
  505. }
  506. </style>