移动端
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

reportLineSummary.vue 12 KiB

před 2 roky
před 2 roky
před 2 roky
před 2 roky
před 2 roky
před 2 roky
před 2 roky
před 2 roky
před 2 roky
před 2 roky
před 2 roky
před 2 roky
před 2 roky
před 2 roky
před 2 roky
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473
  1. <template>
  2. <div class="app-container">
  3. <div class="header_main-placeholder">
  4. <div class="header_main">
  5. 行级填报
  6. <div class="return_btn" @click="back"></div>
  7. <div class="add_btn" @click="add"></div>
  8. </div>
  9. </div>
  10. <van-form ref="form" readonly :class="{'form_readonly': disableEdit}">
  11. <van-row>
  12. <van-col :span="editorData.templateId ? 16 : 24">
  13. <field-select
  14. class="template-selector"
  15. :value="editorData.templateId"
  16. label=" 模板"
  17. value-key="reportName"
  18. data-key="id"
  19. placeholder="报表模板"
  20. :rules="[{ required: true }]"
  21. :readonly="true"
  22. :columns="templateList"
  23. @input="getTemplate"
  24. />
  25. </van-col>
  26. <van-col span="8" v-if="!!editorData.templateId">
  27. <field-date-picker
  28. class="field_no-label"
  29. v-model="editorData.reportYear"
  30. placeholder="报表年度"
  31. formatter="yyyy"
  32. :readonly="disableEdit"
  33. input-align="center"
  34. type="year"
  35. />
  36. </van-col>
  37. </van-row>
  38. <van-row v-if="!!editorData.templateId">
  39. <van-col span="8">
  40. <van-field class="field_no-label" :readonly="disableEdit" v-model="editorData.titleLeft" label="" placeholder="左上" input-align="left"/>
  41. </van-col>
  42. <van-col span="8">
  43. <van-field class="field_no-label" :readonly="disableEdit" v-model="editorData.titleCenter" label="" placeholder="中上" input-align="center"/>
  44. </van-col>
  45. <van-col span="8">
  46. <van-field class="field_no-label" :readonly="disableEdit" v-model="editorData.titleRight" label="" placeholder="右上" input-align="right"/>
  47. </van-col>
  48. </van-row>
  49. <div class="main-table" v-if="!!editorData.templateId">
  50. <table>
  51. <thead>
  52. <tr v-for="(headerRow, rindex) in editorData.headerRows">
  53. <th v-for="(header) in removePlaceholder(headerRow)" :__Col="header.headerSort" :__Row="header.headerRowSort" :colspan="header.colspan" :rowspan="header.rowspan">
  54. {{header.headerName}}
  55. </th>
  56. </tr>
  57. </thead>
  58. <tbody>
  59. <tr v-for="(row, rindex) in editorData.rows">
  60. <td v-for="(col, cindex) in removePlaceholder(row)" :colspan="col.colspan" :rowspan="col.rowspan" :style="{
  61. 'text-align': calcAlign(col.type),
  62. 'background-color': calcColor(col.type),
  63. }">
  64. <div class="full-height">
  65. <div class="full-height" v-if="col.type === '2'">
  66. <input class="input-field align-right full-height" v-model="col.val" :readonly="disableEdit" type="number"></input>
  67. </div>
  68. <div class="full-height" v-else-if="col.type === '4'">
  69. <input class="input-field align-center full-height" v-model="col.name" :readonly="disableEdit"></input>
  70. </div>
  71. <div v-else :style="{'text-align': calcAlign(col.type)}">{{col.name}}</div>
  72. <van-icon name="edit" v-if="cindex === editorData.headerTypes.length - 1 && canEdit(col)" class="edit-icon" color="#1989fa" size="24" @click="edit(col)"/>
  73. </div>
  74. </td>
  75. </tr>
  76. </tbody>
  77. </table>
  78. </div>
  79. <template v-if="!!editorData.templateId">
  80. <div>
  81. <van-field :readonly="disableEdit" v-model="editorData.reportRemark" label="备注" placeholder="报表备注"/>
  82. </div>
  83. <!-- <div>
  84. <van-field readonly :value="editorData.rule" label="规则" placeholder="报表效验公式"></van-field>
  85. </div>-->
  86. </template>
  87. </van-form>
  88. </div>
  89. </template>
  90. <script>
  91. import FieldSelect from "@/components/form/FieldSelect";
  92. import {
  93. addReport, delReport,
  94. getReport,
  95. getReportTemplate,
  96. listReporttitle, summaryList,
  97. updateReport
  98. } from "@/api/sunVillage_info/entity/report";
  99. import {array_grouping, array_toMap, date_format} from "@/utils";
  100. import {Expression} from "@/utils/expression";
  101. import {is_not_number} from "@/utils/utils";
  102. import FieldDatePicker from "@/components/form/FieldDatePicker";
  103. import {Notify} from "vant";
  104. import Cookies from "js-cookie";
  105. export default {
  106. name: "ReportLineSummary",
  107. components: {FieldDatePicker, FieldSelect},
  108. data() {
  109. return {
  110. editorData: {
  111. id: null,
  112. templateId: null,
  113. reportRemark: null,
  114. titleLeft: null,
  115. titleCenter: null,
  116. titleRight: null,
  117. reportStatus: "0",
  118. createBy: null,
  119. createTime: null,
  120. updateBy: null,
  121. updateTime: null,
  122. reportName: '',
  123. operatorName: '',
  124. operatorDate: '',
  125. operatorDepartment: '',
  126. rule: null,
  127. reportYear: date_format('%Y'),
  128. headers: [],
  129. rows: [],
  130. cells: [],
  131. rules: [],
  132. headerRows: [],
  133. headerLength: 0,
  134. headerDeep: 0,
  135. headerTypes: [],
  136. header: null,
  137. },
  138. templateList: [],
  139. loading: false,
  140. disableEdit: false,
  141. intent: 'add',
  142. templateId: null,
  143. };
  144. },
  145. created() {
  146. this.getTemplateList();
  147. this.parseQuery();
  148. },
  149. mounted(){
  150. this.init();
  151. },
  152. methods: {
  153. getTemplateList() {
  154. listReporttitle({
  155. type: '2',
  156. reportStatus: '0',
  157. }).then((resp) => {
  158. this.templateList = resp.rows;
  159. });
  160. },
  161. getTemplate() {
  162. if(!this.editorData.templateId)
  163. return;
  164. this.loading = true;
  165. summaryList({
  166. templateId: this.editorData.templateId,
  167. }).then((resp) => {
  168. this.editorData = resp.data;
  169. }).finally(() => {
  170. this.loading = false;
  171. });
  172. },
  173. cellIsPlaceholder(x) {
  174. return x.colspan <= 0 || (x.hasOwnProperty('rowspan') && x.rowspan <= 0);
  175. },
  176. removePlaceholder(cells) {
  177. return cells.filter((x) => !this.cellIsPlaceholder(x));
  178. },
  179. calcAlign(type) {
  180. switch(type)
  181. {
  182. case '2':
  183. return 'right';
  184. case '3':
  185. case '4':
  186. return 'center';
  187. case '1':
  188. return 'left';
  189. }
  190. },
  191. calcColor(type) {
  192. switch(type)
  193. {
  194. case '2':
  195. return 'unset';
  196. case '4':
  197. return 'unset';
  198. case '3':
  199. return '#d7e8f3';
  200. case '1':
  201. return '#aad8f6';
  202. }
  203. },
  204. calcTextColor(type) {
  205. switch(type)
  206. {
  207. case '2':
  208. case '4':
  209. return '#2facfe';
  210. case '3':
  211. case '1':
  212. return '#858585';
  213. }
  214. },
  215. add() {
  216. this.$router.push({
  217. name: 'entityReportLineView',
  218. query: {
  219. intent: 'add',
  220. templateId: this.templateId,
  221. }
  222. });
  223. },
  224. reset() {
  225. this.$refs.form.resetValidation();
  226. this.editorData = {
  227. id: null,
  228. deptId: null,
  229. deptName: null,
  230. templateId: null,
  231. reportName: null,
  232. reportYear: null,
  233. reportRemark: null,
  234. titleLeft: null,
  235. titleCenter: null,
  236. titleRight: null,
  237. rule: null,
  238. operatorName: null,
  239. operatorDate: null,
  240. createBy: null,
  241. createTime: null,
  242. updateBy: null,
  243. updateTime: null,
  244. headers: [],
  245. rows: [],
  246. cells: [],
  247. rules: [],
  248. headerRows: [],
  249. headerLength: 0,
  250. headerDeep: 0,
  251. headerTypes: [],
  252. header: null,
  253. };
  254. },
  255. parseQuery() {
  256. let query = this.$route.query;
  257. this.templateId = query.templateId;
  258. this.intent = query.intent;
  259. if(!this.templateId)
  260. {
  261. this.$router.back();
  262. return;
  263. }
  264. },
  265. init() {
  266. this.editorData.templateId = this.templateId;
  267. this.getTemplate();
  268. this.disableEdit = this.intent === 'view';
  269. },
  270. back() {
  271. this.$router.back();
  272. },
  273. notify(message, type) {
  274. Notify.clear();
  275. Notify({ type: type || 'primary', message: message });
  276. },
  277. edit(row) {
  278. this.$router.push({
  279. name: 'entityReportLineView',
  280. query: {
  281. intent: 'edit',
  282. templateId: '',
  283. reportId: row.reportId,
  284. }
  285. });
  286. },
  287. canEdit(col) {
  288. return col.createBy == Cookies.get('deptId');
  289. },
  290. },
  291. computed: {
  292. isAdd() {
  293. return this.intent === 'add';
  294. },
  295. isEdit() {
  296. return this.intent === 'edit';
  297. },
  298. isView() {
  299. return this.intent === 'view';
  300. },
  301. }
  302. }
  303. </script>
  304. <style scoped lang="scss">
  305. .app-container{
  306. background: #e9e9e9;
  307. min-height: 100vh;
  308. width: 100vw;
  309. .header_main-placeholder {
  310. height: 116px;
  311. }
  312. .header_main {
  313. height: 116px;
  314. background: url('../../../assets/images/sunVillage_info/list_head.png') no-repeat;
  315. background-size: 100% 100%;
  316. position: fixed;
  317. top: 0;
  318. left: 0;
  319. width: 100%;
  320. font-size: 36px;
  321. line-height: 116px;
  322. text-align: center;
  323. color: #fff;
  324. z-index: 999;
  325. .return_btn {
  326. width: 24px;
  327. height: 43.2px;
  328. background: url('../../../assets/images/sunVillage_info/list_icon_5.png') center center no-repeat;
  329. background-size: 20px 36px;
  330. position: absolute;
  331. left: 38px;
  332. top: 36px;
  333. }
  334. .add_btn {
  335. width: 56.4px;
  336. height: 40.8px;
  337. background: url('../../../assets/images/sunVillage_info/list_icon_9.png') center center no-repeat;
  338. background-size: 47px 34px;
  339. position: absolute;
  340. right: 38px;
  341. top: 36px;
  342. }
  343. }
  344. .main-table {
  345. overflow-x: auto;
  346. overflow-y: auto;
  347. position: relative;
  348. background-color: #ffffff;
  349. padding: 0.15rem 0.15rem;
  350. border-radius: 0.15rem;
  351. margin: 0.1rem 0.1rem;
  352. table {
  353. /*width: max-content;*/
  354. border-collapse: collapse;
  355. border: 0.01rem solid #1989fa;
  356. table-layout: fixed;
  357. }
  358. th {
  359. text-align: center;
  360. border: 0.01rem solid #1989fa;
  361. min-height: 1rem;
  362. font-size: 0.32rem;
  363. padding: 0.4rem 0.4rem;
  364. margin: 0;
  365. font-weight: bold;
  366. min-width: 1rem;
  367. /*max-width: 2rem;*/
  368. white-space: nowrap;
  369. }
  370. td {
  371. font-size: 0.3rem;
  372. border: 0.01rem solid #1989fa;
  373. height: 1rem;
  374. white-space: break-spaces;
  375. word-wrap: break-word;
  376. overflow-wrap: break-word;
  377. padding: 0 0.1rem;
  378. margin: 0;
  379. /*max-width: 1.5rem;*/
  380. position: relative;
  381. min-width: 1rem;
  382. }
  383. .input-field {
  384. width: 100%;
  385. background-color: unset;
  386. border: 0;
  387. }
  388. .validate-error {
  389. color: #F56C6C;
  390. }
  391. .validate-error-box {
  392. color: #F56C6C;
  393. border: 0.02rem solid #F56C6C;
  394. }
  395. }
  396. .align-right {
  397. text-align: right;
  398. }
  399. .align-center {
  400. text-align: center;
  401. }
  402. .full-height {
  403. height: 100%;
  404. }
  405. /deep/ .van-field__label {
  406. background-color: #2facfe;
  407. margin: 0;
  408. color: #fff;
  409. border-top-left-radius: 0.15rem;
  410. border-bottom-left-radius: 0.15rem;
  411. padding: 0 0.2rem;
  412. display: flex;
  413. align-items: center;
  414. }
  415. /deep/ .van-field__body {
  416. background-color: #ffffff;
  417. border-top-right-radius: 0.15rem;
  418. border-bottom-right-radius: 0.15rem;
  419. padding: 0 0.1rem;
  420. }
  421. /deep/ .van-field__body {
  422. height: 100%;
  423. }
  424. /deep/ .van-field {
  425. background-color: unset;
  426. padding: 0.1rem 0.15rem;
  427. height: 1rem;
  428. }
  429. .field_no-label /deep/ .van-field__body {
  430. border-top-left-radius: 0.15rem;
  431. border-bottom-left-radius: 0.15rem;
  432. }
  433. .template-selector /deep/ span {
  434. padding-left: 0.8rem;
  435. background: #2facfe url('../../../assets/images/sunVillage_info/list_icon_11.png') left center no-repeat;
  436. background-size: 0.45rem;
  437. }
  438. .form_readonly /deep/ .van-icon-arrow-down {
  439. display: none;
  440. }
  441. .edit-icon {
  442. display: inline-block;
  443. width: 0.6rem;
  444. position: absolute;
  445. right: -0.6rem;
  446. top: calc(50% - 0.3rem);
  447. }
  448. }
  449. </style>