You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

408 lines
12 KiB

6 months ago
5 months ago
6 months ago
  1. <template>
  2. <div class="customer-css" >
  3. <!-- 查询时间和产品 -->
  4. <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 0px;" >
  5. <el-row>
  6. <el-form-item :label="'报表名称:'">
  7. <el-input v-model="pageData.reportName" style="width: 120px"></el-input>
  8. </el-form-item>
  9. <el-form-item :label="'报表分类:'">
  10. <el-select v-model="pageData.reportType" style="width: 130px">
  11. <el-option
  12. v-for="(item, index) in reportTypeList"
  13. :key="index"
  14. :label="item.baseData"
  15. :value="item.baseData">
  16. </el-option>
  17. </el-select>
  18. </el-form-item>
  19. <el-form-item :label="''" style="margin-left: 50px; margin-top: 20px;">
  20. <el-button class="customer-bun-min" type="primary" @click="refreshPageTables" style="margin-left: 10px; margin-bottom: 5px;">查询</el-button>
  21. <el-button class="customer-bun-min" type="primary" @click="addReportModal" style="margin-left: 10px; margin-bottom: 5px;">新增</el-button>
  22. </el-form-item>
  23. </el-row>
  24. </el-form>
  25. <!-- 工单主表信息 -->
  26. <el-main style="margin-top: 5px; padding: 0px; width: 100%;">
  27. <el-table
  28. :height="height"
  29. :data="reportList"
  30. border
  31. ref="reportTable"
  32. highlight-current-row
  33. @row-click="setCurrentReportRow"
  34. v-loading="dataListLoading"
  35. style="margin-top: 0px; width: 100%;">
  36. <el-table-column
  37. fixed="left"
  38. header-align="center"
  39. align="center"
  40. width="220"
  41. :label="'操作'">
  42. <template slot-scope="scope">
  43. <a class="customer-a" @click="editCustomerReportModal(scope.row)">编辑</a>
  44. <a class="customer-a" @click="warnDeleteCustomerReportConfirm(scope.row)">删除</a>
  45. <a class="customer-a" @click="editCustomerReportSearchColumnModal(scope.row)">查询参数维护</a>
  46. <a class="customer-a" @click="showCustomerReportSearchColumnModal(scope.row)">查询</a>
  47. <a class="customer-a" @click="showAuthCustomerReportModal(scope.row)">权限</a>
  48. </template>
  49. </el-table-column>
  50. <el-table-column
  51. v-for="(item,index) in columnReportArray" :key="index"
  52. :sortable="item.columnSortable"
  53. :prop="item.columnProp"
  54. :header-align="item.headerAlign"
  55. :show-overflow-tooltip="item.showOverflowTooltip"
  56. :align="item.align"
  57. :fixed="item.fixed==''?false:item.fixed"
  58. :width="item.columnWidth"
  59. :label="item.columnLabel">
  60. <template slot-scope="scope">
  61. <span v-if="!item.columnHidden"> {{scope.row[item.columnProp]}}</span>
  62. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  63. style="width: 100px; height: 80px"/></span>
  64. </template>
  65. </el-table-column>
  66. </el-table>
  67. </el-main>
  68. <!-- 新增 -->
  69. <addCustomerReport ref="addCustomerReport" :close-on-click-modal="false"
  70. :visible.sync="addCustomerReportFlag"
  71. @refreshCurrentPage = "refreshCurrentPage">
  72. </addCustomerReport>
  73. <!-- 修改 -->
  74. <updateCustomerReport ref="updateCustomerReport" :close-on-click-modal="false"
  75. :visible.sync="updateCustomerReportFlag"
  76. @refreshCurrentPage = "refreshCurrentPage">
  77. </updateCustomerReport>
  78. <!-- 查询参数维护 -->
  79. <editCustomerReportSearchColumn ref="editCustomerReportSearchColumn" :close-on-click-modal="false"
  80. :visible.sync="editCustomerReportSearchColumnFlag"
  81. @refreshCurrentPage = "refreshCurrentPage">
  82. </editCustomerReportSearchColumn>
  83. <!-- 查询列展示 -->
  84. <showCustomerReportSearchColumn ref="showCustomerReportSearchColumn" :close-on-click-modal="false"
  85. :visible.sync="showCustomerReportSearchColumnFlag"
  86. @refreshCurrentPage = "refreshCurrentPage">
  87. </showCustomerReportSearchColumn>
  88. <!-- 查询列展示 -->
  89. <authSingleCustomerReport ref="authSingleCustomerReport" :close-on-click-modal="false"
  90. :visible.sync="showAuthCustomerReportFlag"
  91. @refreshCurrentPage = "refreshCurrentPage">
  92. </authSingleCustomerReport>
  93. </div>
  94. </template>
  95. <script>
  96. /*组件*/
  97. import addCustomerReport from '@/views/modules/report/com_add_customer_report';/*新增自定义报表的功能*/
  98. import updateCustomerReport from '@/views/modules/report/com_update_customer_report';/*新增自定义报表的功能*/
  99. import editCustomerReportSearchColumn from '@/views/modules/report/com_edit_customer_report_search_column';/*新增自定义报表的功能*/
  100. import showCustomerReportSearchColumn from '@/views/modules/report/com_show_customer_report_search_column';/*新增自定义报表的功能*/
  101. import authSingleCustomerReport from '@/views/modules/report/com_auth_single_customer_report';/*单个报表赋权限*/
  102. import {
  103. getReportTypeList,
  104. getCurrentPageTables,
  105. deleteCustomerReport,
  106. } from '@/api/report/report_manage.js'
  107. export default {
  108. data() {
  109. return {
  110. height: 200,
  111. reportTypeList: [],
  112. addCustomerReportFlag: false,
  113. updateCustomerReportFlag: false,
  114. editCustomerReportSearchColumnFlag: false,
  115. showCustomerReportSearchColumnFlag: false,
  116. showAuthCustomerReportFlag: false,
  117. currentReportRow: {},
  118. pageData: {
  119. site: this.$store.state.user.site,
  120. username: this.$store.state.user.name,
  121. reportName: '',
  122. reportType: '',
  123. seqNo: 0,
  124. status: 1,
  125. },
  126. reportList: [],
  127. dataListLoading: false,
  128. columnReportArray: [
  129. {
  130. userId: this.$store.state.user.name,
  131. functionId: 5306,
  132. serialNumber: '5306ReportReportId',
  133. tableId: "5306Report",
  134. tableName: "自定义报表",
  135. columnProp: "reportId",
  136. headerAlign: "center",
  137. align: "center",
  138. columnLabel: "报表ID",
  139. columnWidth: '',
  140. columnHidden: false,
  141. columnImage: false,
  142. columnSortable: false,
  143. sortLv: 0,
  144. status: true,
  145. fixed: false
  146. },
  147. {
  148. userId: this.$store.state.user.name,
  149. functionId: 5306,
  150. serialNumber: '5306ReportReportName',
  151. tableId: "5306Report",
  152. tableName: "自定义报表",
  153. columnProp: "reportName",
  154. headerAlign: "center",
  155. align: "center",
  156. columnLabel: "报表名称",
  157. columnWidth: '',
  158. columnHidden: false,
  159. columnImage: false,
  160. columnSortable: false,
  161. sortLv: 0,
  162. status: true,
  163. fixed: false
  164. },
  165. {
  166. userId: this.$store.state.user.name,
  167. functionId: 5306,
  168. serialNumber: '5306ReportReportType',
  169. tableId: "5306Report",
  170. tableName: "自定义报表",
  171. columnProp: "reportType",
  172. headerAlign: "center",
  173. align: "center",
  174. columnLabel: "报表分类",
  175. columnWidth: '',
  176. columnHidden: false,
  177. columnImage: false,
  178. columnSortable: false,
  179. sortLv: 0,
  180. status: true,
  181. fixed: false
  182. },
  183. {
  184. userId: this.$store.state.user.name,
  185. functionId: 5306,
  186. serialNumber: '5306ReportReportRemark',
  187. tableId: "5306Report",
  188. tableName: "自定义报表",
  189. columnProp: "reportRemark",
  190. headerAlign: "center",
  191. align: "center",
  192. columnLabel: "备注",
  193. columnWidth: '',
  194. columnHidden: false,
  195. columnImage: false,
  196. columnSortable: false,
  197. sortLv: 0,
  198. status: true,
  199. fixed: false
  200. },
  201. ],
  202. }
  203. },
  204. /*组件*/
  205. components: {
  206. addCustomerReport,/*新增自定义报表的功能*/
  207. updateCustomerReport,/*报表修改*/
  208. editCustomerReportSearchColumn,/*查询列修改*/
  209. showCustomerReportSearchColumn,/*显示查询列参数*/
  210. authSingleCustomerReport,/*单个报表赋权限*/
  211. },
  212. mounted() {
  213. this.$nextTick(() => {
  214. this.height = window.innerHeight - 165;
  215. })
  216. },
  217. methods: {
  218. /*刷新报工的类型*/
  219. refreshReportType(){
  220. let requestData = {'type': 'report_type'};
  221. getReportTypeList(requestData).then(({data}) => {
  222. this.reportTypeList = data.rows;
  223. //选则第一个
  224. this.pageData.reportType = data.rows[0].baseData;
  225. //加载当前报表数据
  226. this.refreshPageTables();
  227. })
  228. },
  229. /*刷新页面table*/
  230. refreshCurrentPage(){
  231. this.refreshPageTables();
  232. },
  233. /*获取工单信息*/
  234. refreshPageTables() {
  235. getCurrentPageTables(this.pageData).then(({data}) => {
  236. this.reportList = data.rows;
  237. //清空已经选好的行数据
  238. this.currentReportRow = null;
  239. })
  240. },
  241. /*刷新当前的页面的显示数据*/
  242. addReportModal(orderRow){
  243. this.$nextTick(() => {
  244. this.addCustomerReportFlag = true;
  245. this.$refs.addCustomerReport.init();
  246. });
  247. },
  248. /*修改当前的定制报表数据*/
  249. editCustomerReportModal(currentRow){
  250. this.$nextTick(() => {
  251. this.updateCustomerReportFlag = true;
  252. this.$refs.updateCustomerReport.init(currentRow.reportId);
  253. });
  254. },
  255. /*查询列维护*/
  256. editCustomerReportSearchColumnModal(currentRow){
  257. this.$nextTick(() => {
  258. this.editCustomerReportSearchColumnFlag = true;
  259. this.$refs.editCustomerReportSearchColumn.init(currentRow.reportId);
  260. });
  261. },
  262. /*展示查询列*/
  263. showCustomerReportSearchColumnModal(currentRow){
  264. this.$nextTick(() => {
  265. this.showCustomerReportSearchColumnFlag = true;
  266. this.$refs.showCustomerReportSearchColumn.init(currentRow.reportId);
  267. });
  268. },
  269. /*给单个报表赋权限*/
  270. showAuthCustomerReportModal(currentRow){
  271. this.$nextTick(() => {
  272. this.showAuthCustomerReportFlag = true;
  273. this.$refs.authSingleCustomerReport.init(currentRow);
  274. });
  275. },
  276. /*设置工艺的行*/
  277. setCurrentReportRow(row, column, event) {
  278. this.currentReportRow = row;
  279. },
  280. /*提醒是否删除的提示*/
  281. warnDeleteCustomerReportConfirm(currentCustomerReport) {
  282. this.$confirm('确实要删除报表'+currentCustomerReport.reportName+'吗?', '提示', {
  283. confirmButtonText: '确认',
  284. celButtonText: '取消',
  285. type: 'warning'
  286. }).then(() => {
  287. //执行删除定制报表的功能
  288. this.deleteCustomerReportOperation(currentCustomerReport);
  289. });
  290. },
  291. /*执行删除定制报表的功能*/
  292. deleteCustomerReportOperation(currentCustomerReport) {
  293. //执行删除卷的操作
  294. deleteCustomerReport(currentCustomerReport).then(({data}) => {
  295. //判断是否成功
  296. if (data.code == 200) {
  297. this.$message.success(data.msg);
  298. //刷新报工的页面
  299. this.refreshPageTables();
  300. } else {
  301. this.$message.error(data.msg);
  302. }
  303. });
  304. },
  305. },
  306. created() {
  307. //查询报表的类型
  308. this.refreshReportType();
  309. },
  310. }
  311. </script>
  312. <!--当前页面的标签样式-->
  313. <style scoped lang="scss">
  314. /*针对el-card*/
  315. .customer-card .el-form-item__content{
  316. margin-top: -15px;
  317. }
  318. .customer-card .el-form-item{
  319. height: 22px;
  320. }
  321. .customer-border .el-form-item__content{
  322. margin-top: -30px;
  323. }
  324. /*全局年与日类型 宽度*/
  325. div.el-time-width{
  326. width: 110px !important;
  327. }
  328. /* 全局时间右边框*/
  329. .customer-css input.el-input__inner{
  330. height: 22px !important;
  331. padding-right: 0px !important;
  332. }
  333. /* 控制el-card标签的数据*/
  334. div.customer-el-card {
  335. margin-left: 110px;
  336. margin-top: -15px;
  337. height: 20px;
  338. width: 60px;
  339. }
  340. /* 颜色控制 */
  341. div.customer-el-card-pink {
  342. background: #FF00FF;
  343. }
  344. div.customer-el-card-orange {
  345. background: #FFD700;
  346. }
  347. div.customer-el-card-blue {
  348. background: #0000CD;
  349. }
  350. /*清掉样式*/
  351. .el-radio+.el-radio {
  352. margin-left: 0px;
  353. }
  354. /*当前按钮的通用样式*/
  355. .customer-css .customer-bun-mid{
  356. width: 60px;
  357. text-align: center;
  358. }
  359. .customer-css .customer-bun-min{
  360. width: 50px;
  361. text-align: center;
  362. }
  363. .customer-css .customer-bun-max{
  364. width: 80px;
  365. text-align: center;
  366. }
  367. /*当前按钮的通用样式*/
  368. .customer-css .el-button--medium {
  369. padding: 5px 5px;
  370. }
  371. </style>