doubleWeeklyApproval.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452
  1. <template>
  2. <div>
  3. <!-- 顶部条-->
  4. <div class="navBarTOP">
  5. <van-nav-bar class="navBar" title="半月报审批" left-arrow @click-left="onClickLeft" />
  6. </div>
  7. <!-- 主体内容-->
  8. <div class="container linep">
  9. <div class="lineGrey"></div>
  10. <div class="lineGrey"></div>
  11. <div class="lineGrey"></div>
  12. <div class="lineGrey"></div>
  13. <div class="lineGrey"></div>
  14. <van-collapse v-model="activeNames">
  15. <Atarget :reportInfo="reportTarget"></Atarget>
  16. <Btarget :reportInfo="reportTarget"></Btarget>
  17. <div class="contentContainer" v-if="reportTarget.isHistory == '0'">
  18. <!-- isHistory 是否为历史汇报:0-新汇报 1-历史汇报 -->
  19. <reportCustom
  20. ref="reportCustom"
  21. :disabled="true"
  22. :reportCustomData="reportTarget.customTaskList"></reportCustom>
  23. </div>
  24. <template v-else>
  25. <van-collapse-item title="上期工作成果" name="7">
  26. <div style="margin-top: -10px">
  27. <div v-for="(item, index) in reportContentsList2" :key="index">
  28. <!-- <p class="texttitle"><span class="opint"></span><span>{{selectDictLabel(weekType,item.doubleWeekType)}}</span></p>-->
  29. <p class="texttitle texttitle2">计划工作进度</p>
  30. <div style="padding: 10px 0; min-height: 32px" class="contentContainer">
  31. <van-field
  32. v-model="reportContentsList1[index].doubleWeekContent"
  33. rows="4"
  34. autosize
  35. readonly
  36. type="textarea" />
  37. </div>
  38. <p class="texttitle texttitle2">实际工作进度</p>
  39. <div style="padding: 10px 0; min-height: 32px" class="contentContainer">
  40. <van-field
  41. v-model="item.doubleWeekContent"
  42. rows="4"
  43. autosize
  44. readonly
  45. type="textarea" />
  46. </div>
  47. </div>
  48. </div>
  49. </van-collapse-item>
  50. <van-collapse-item title="本期工作规划" name="8">
  51. <div style="margin-top: -10px">
  52. <div v-for="(item2, index2) in reportContentsList3" :key="index2">
  53. <div style="padding: 10px 0; min-height: 32px" class="contentContainer">
  54. <van-field
  55. v-model="item2.doubleWeekContent"
  56. rows="4"
  57. autosize
  58. readonly
  59. type="textarea" />
  60. </div>
  61. </div>
  62. </div>
  63. </van-collapse-item>
  64. </template>
  65. </van-collapse>
  66. <div class="contentContainer">
  67. <p class="contentContainerTitle">打分 <span>请点亮小星星,一颗小星星代表1分</span></p>
  68. <div style="padding: 10px 0">
  69. <van-rate
  70. v-model="number"
  71. :size="25"
  72. color="#ffd21e"
  73. void-icon="star"
  74. void-color="#eee" />
  75. <span class="rateText">&nbsp;&nbsp;&nbsp;&nbsp;{{ number }}分</span>
  76. </div>
  77. </div>
  78. <div class="contentContainer">
  79. <p class="contentContainerTitle">评语</p>
  80. <div style="padding: 10px 0">
  81. <van-field
  82. v-model="Content"
  83. rows="4"
  84. autosize
  85. type="textarea"
  86. maxlength="800"
  87. show-word-limit
  88. :formatter="formatter" />
  89. </div>
  90. </div>
  91. <br />
  92. <br />
  93. <van-row>
  94. <van-col span="12">
  95. <van-button type="info" size="small" plain class="Btn" @click="submit"
  96. >确认审批</van-button
  97. >
  98. </van-col>
  99. <van-col span="12">
  100. <van-button type="info" size="small" plain class="BtnBorder" @click="reject"
  101. >退回重写</van-button
  102. >
  103. </van-col>
  104. </van-row>
  105. </div>
  106. <br />
  107. <br />
  108. <br />
  109. <br />
  110. </div>
  111. </template>
  112. <script>
  113. import { double_week_type, updateReport, getDetailById, getReportInfo } from '@/api/index';
  114. import createStoreBJ from '@/views/componentsTarget/createStoreBJ';
  115. import ZYPlaceOrder from '@/views/componentsTarget/ZYPlaceOrder';
  116. import performanceSAP from '@/views/componentsTarget/performanceSAP';
  117. import ZYSAP from '@/views/componentsTarget/ZYSAP';
  118. import veryGoodPlaceOrder from '@/views/componentsTarget/veryGoodPlaceOrder';
  119. import neiwaiqiangpingtu from '@/views/componentsTarget/neiwaiqiangpingtu';
  120. import zhiganwaiqiangSAP from '@/views/componentsTarget/zhiganwaiqiangSAP';
  121. import Atarget from '@/views/home/Atarget.vue';
  122. import Btarget from '@/views/home/Btarget.vue';
  123. import reportCustom from './reportCustom.vue';
  124. export default {
  125. name: 'home',
  126. components: {
  127. createStoreBJ,
  128. ZYPlaceOrder,
  129. performanceSAP,
  130. ZYSAP,
  131. veryGoodPlaceOrder,
  132. neiwaiqiangpingtu,
  133. zhiganwaiqiangSAP,
  134. Atarget,
  135. Btarget,
  136. reportCustom,
  137. },
  138. data() {
  139. return {
  140. form: { rate: 0, message: '' },
  141. activeNames: [
  142. '1',
  143. '2',
  144. '3',
  145. '4',
  146. '5',
  147. '6',
  148. '7',
  149. '8',
  150. '11',
  151. '12',
  152. '16',
  153. '17',
  154. '27',
  155. '28',
  156. '29',
  157. ],
  158. powerGrade: '',
  159. value: '2',
  160. Content: '',
  161. number: 0,
  162. timeList: [],
  163. reportTargetAll: {},
  164. reportContentsList1: [],
  165. reportContentsList2: [],
  166. reportContentsList3: [],
  167. updateReport: {},
  168. weekType: [],
  169. type: '-1',
  170. JZQuota: false,
  171. reportTarget: {},
  172. };
  173. },
  174. created() {
  175. this.powerGrade = localStorage.getItem('powerGrade');
  176. this.getReportInfo();
  177. double_week_type().then((res) => {
  178. this.weekType = res.data;
  179. });
  180. },
  181. watch: {
  182. $route(to, from) {
  183. this.powerGrade = localStorage.getItem('powerGrade');
  184. if (to.path == '/doubleWeeklyApproval') {
  185. this.getReportInfo();
  186. this.number == 0;
  187. this.Content = '';
  188. }
  189. },
  190. },
  191. methods: {
  192. formatter(value) {
  193. return value.replace(
  194. /[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF][\u200D|\uFE0F]|[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF]|[0-9|*|#]\uFE0F\u20E3|[0-9|#]\u20E3|[\u203C-\u3299]\uFE0F\u200D|[\u203C-\u3299]\uFE0F|[\u2122-\u2B55]|\u303D|[\A9|\AE]\u3030|\uA9|\uAE|\u3030/gi,
  195. '',
  196. );
  197. },
  198. reject() {
  199. let loading1 = this.$toast.loading({
  200. duration: 0,
  201. message: '数据提交中...',
  202. forbidClick: true,
  203. });
  204. if (this.Content.trim() == '') {
  205. this.$toast('评语未填写');
  206. return false;
  207. }
  208. if (this.Content.length > 800) {
  209. this.$toast('评语内容不能超过800字');
  210. return false;
  211. }
  212. this.reportTarget.number = this.number;
  213. this.reportTarget.failContent = this.Content;
  214. this.reportTarget.failContent = this.reportTarget.failContent;
  215. this.reportTarget.status = 2;
  216. updateReport(this.reportTarget).then((res) => {
  217. loading1.clear();
  218. if (res.code == 200) {
  219. this.$dialog
  220. .alert({
  221. title: '系统提示',
  222. message: '提交成功',
  223. })
  224. .then(() => {
  225. window.location.replace(window.location.origin + '/mobile/dailyApprovalList');
  226. });
  227. } else {
  228. this.$toast.fail(res.msg);
  229. }
  230. });
  231. },
  232. submit() {
  233. let loading1 = this.$toast.loading({
  234. duration: 0,
  235. message: '数据提交中...',
  236. forbidClick: true,
  237. });
  238. if (this.number == '0') {
  239. this.$toast('评分未选择');
  240. return false;
  241. }
  242. if (this.Content.trim() == '') {
  243. this.$toast('评语未填写');
  244. return false;
  245. }
  246. if (this.Content.length > 800) {
  247. this.$toast('评语内容超过800字');
  248. return false;
  249. }
  250. this.reportTarget.number = this.number;
  251. this.reportTarget.successContent = this.Content;
  252. this.reportTarget.successContent = this.reportTarget.successContent;
  253. this.reportTarget.status = 3;
  254. updateReport(this.reportTarget).then((res) => {
  255. loading1.clear();
  256. if (res.code == 200) {
  257. this.$dialog
  258. .alert({
  259. title: '系统提示',
  260. message: '提交成功',
  261. })
  262. .then(() => {
  263. window.location.replace(window.location.origin + '/mobile/dailyApprovalList');
  264. });
  265. } else {
  266. this.$toast.fail(res.msg);
  267. }
  268. });
  269. },
  270. getReportInfo() {
  271. let loading1 = this.$toast.loading({
  272. duration: 0,
  273. message: '加载中...',
  274. forbidClick: true,
  275. });
  276. getDetailById({ reportId: this.$route.query.reportId }).then((res) => {
  277. loading1.clear();
  278. if (res.code == 200) {
  279. this.JZQuota = false;
  280. if (res.data.postType == 'JZ') {
  281. this.JZQuota = true;
  282. }
  283. if (res.data.status != '1') {
  284. this.$dialog
  285. .alert({
  286. title: '系统提示',
  287. message: '半月报已审批',
  288. })
  289. .then(() => {
  290. window.location.replace(window.location.origin + '/mobile/home');
  291. });
  292. } else {
  293. this.reportTargetAll = res.data.reportTargetAll;
  294. this.reportTarget = res.data;
  295. this.type = res.data.userType;
  296. this.reportContents = res.data.reportContents;
  297. var reportContentsList1 = [];
  298. var reportContentsList2 = [];
  299. var reportContentsList3 = [];
  300. var reportContentsdata = res.data.reportContents;
  301. for (var i = 0; i < res.data.reportContents.length; i++) {
  302. if (res.data.reportContents[i].type == '1') {
  303. reportContentsList1.push(reportContentsdata[i]);
  304. }
  305. if (res.data.reportContents[i].type == '2') {
  306. reportContentsList2.push(reportContentsdata[i]);
  307. }
  308. if (res.data.reportContents[i].type == '3') {
  309. reportContentsList3.push(reportContentsdata[i]);
  310. }
  311. }
  312. var ln1 = reportContentsList1.length;
  313. var ln2 = reportContentsList2.length;
  314. if (reportContentsList2.length > reportContentsList1.length) {
  315. var len = ln2 - ln1;
  316. for (var x = 0; x < len; x++) {
  317. reportContentsList1.push({
  318. doubleWeekContent: '',
  319. });
  320. }
  321. }
  322. this.reportContentsList1 = reportContentsList1;
  323. this.reportContentsList2 = reportContentsList2;
  324. this.reportContentsList3 = reportContentsList3;
  325. }
  326. } else {
  327. this.$toast(res.msg);
  328. }
  329. });
  330. },
  331. onClickLeft() {
  332. this.$router.go(-1);
  333. },
  334. },
  335. };
  336. </script>
  337. <style scoped>
  338. .container {
  339. margin: 10px;
  340. }
  341. .container .van-collapse-item {
  342. margin-bottom: 16px;
  343. }
  344. .linep p {
  345. margin: 6px 0 0 0;
  346. font-size: 14px;
  347. color: #666;
  348. padding-left: 6px;
  349. }
  350. .linep .texttitle {
  351. color: #0057ba;
  352. position: relative;
  353. padding-left: 10px;
  354. }
  355. .linep .texttitle2 {
  356. padding-left: 10px;
  357. }
  358. .linep .texttitle .opint {
  359. position: absolute;
  360. left: 0px;
  361. top: 6px;
  362. margin-right: 6px;
  363. display: inline-block;
  364. width: 6px;
  365. height: 6px;
  366. border-radius: 10px;
  367. background-color: #004d8c;
  368. }
  369. .leftTitle {
  370. background-color: #74a4d9;
  371. color: #fff;
  372. display: inline-block;
  373. padding: 0 4px;
  374. border-radius: 2px;
  375. }
  376. .rightTitle {
  377. background-color: #e7b4bb;
  378. color: #fff;
  379. display: inline-block;
  380. padding: 0 4px;
  381. border-radius: 2px;
  382. }
  383. </style>
  384. <style>
  385. .linep .van-cell__title {
  386. color: #1e5398;
  387. font-weight: 500;
  388. }
  389. .Btn {
  390. margin: 0 auto 10px;
  391. display: block;
  392. width: 90%;
  393. border-radius: 5px;
  394. color: #fff !important;
  395. background-color: #0057ba;
  396. border: 1px solid #0057ba;
  397. height: 36px;
  398. }
  399. .BtnBorder {
  400. margin: 0 auto 10px;
  401. display: block;
  402. width: 90%;
  403. border-radius: 5px;
  404. border: 1px solid #0057ba;
  405. color: #0057ba;
  406. height: 36px;
  407. }
  408. .linep .contentContainer {
  409. background-color: white;
  410. border-radius: 8px;
  411. padding: 10px 16px;
  412. margin-bottom: 10px;
  413. }
  414. .linep .contentContainer .contentContainerTitle {
  415. color: #222;
  416. }
  417. .linep .contentContainer .contentContainerTitle span {
  418. font-size: 12px;
  419. color: #666;
  420. }
  421. .linep .contentContainer .van-field__control,
  422. .linep .contentContainerp .van-field__control {
  423. background-color: #f8f8f8;
  424. padding: 10px;
  425. border-radius: 8px;
  426. }
  427. .linep .contentContainer .van-cell,
  428. .linep .contentContainerp .van-cell {
  429. padding: 0;
  430. }
  431. .van-dialog__confirm,
  432. .van-dialog__confirm:active {
  433. color: #0057ba;
  434. }
  435. </style>