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.

210 lines
5.7 KiB

6 months ago
  1. <template>
  2. <div class="mod-oss">
  3. <el-dialog
  4. v-drag
  5. :title="title"
  6. :close-on-click-modal="false"
  7. :visible.sync="visible"
  8. width="955px"
  9. :append-to-body="true">
  10. <el-form inline="inline" label-position="top">
  11. <el-form-item :label="'模板名称'">
  12. <el-input v-model="reportfile"></el-input>
  13. </el-form-item>
  14. <el-form-item>
  15. <el-button style="margin-top: 22px" @click="getDataList()" type="primary">{{ buttons.select }}</el-button>
  16. </el-form-item>
  17. </el-form>
  18. <el-table
  19. :height="tableHeight"
  20. :data="dataList"
  21. border
  22. v-loading="dataListLoading"
  23. style="width: 100%;">
  24. <el-table-column
  25. v-for="(item,index) in columnList" :key="index"
  26. :sortable="item.columnSortable"
  27. :prop="item.columnProp"
  28. :header-align="item.headerAlign"
  29. :show-overflow-tooltip="item.showOverflowTooltip"
  30. :align="item.align"
  31. :fixed="item.fixed==''?false:item.fixed"
  32. :min-width="item.columnWidth"
  33. :label="item.columnLabel">
  34. <template slot-scope="scope">
  35. <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
  36. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  37. style="width: 100px; height: 80px"/></span>
  38. </template>
  39. </el-table-column>
  40. <el-table-column
  41. fixed="right"
  42. header-align="center"
  43. align="center"
  44. width="150"
  45. :label="buttons.operate">
  46. <template slot-scope="scope">
  47. <a type="text" size="small" @click="printSetting(scope.row)">{{ buttons.settingPrint }}</a>
  48. </template>
  49. </el-table-column>
  50. </el-table>
  51. <span slot="footer" class="dialog-footer">
  52. <el-button @click="visible = false" type="primary">关闭</el-button>
  53. </span>
  54. </el-dialog>
  55. <PrintList ref="printListRef" v-if="printListVisible" @refreshDataList="getDataList"></PrintList>
  56. </div>
  57. </template>
  58. <script>
  59. import {getUserLabelPrintList} from '@/api/print/print.js'
  60. import PrintList from './print-list.vue'
  61. export default {
  62. data() {
  63. return {
  64. tableHeight: 365,
  65. title: '打印机管理',
  66. visible: false,
  67. printListVisible: false,
  68. dataListLoading: true,
  69. dataForm: {
  70. fileName: ''
  71. },
  72. reportfile: '',
  73. dataList: [],
  74. printList: [],
  75. columnList: [
  76. {
  77. "tableId": "common1001",
  78. "tableName": "common",
  79. "columnProp": "reportfile",
  80. "columnLabel": "模板名称",
  81. "columnHidden": false,
  82. "columnImage": false,
  83. "columnSortable": false,
  84. "columnWidth": '15%',
  85. "format": null,
  86. "functionId": this.$route.meta.menuId,
  87. "sortLv": 0,
  88. "status": true,
  89. "fixed": false,
  90. "serialNumber": null,
  91. "columnType": null,
  92. "align": null
  93. },
  94. {
  95. "tableId": "common1001",
  96. "tableName": "common",
  97. "columnProp": "userid",
  98. "columnLabel": "用户名",
  99. "columnHidden": false,
  100. "columnImage": false,
  101. "columnSortable": false,
  102. "columnWidth": '15%',
  103. "format": null,
  104. "functionId": this.$route.meta.menuId,
  105. "sortLv": 0,
  106. "status": true,
  107. "fixed": false,
  108. "serialNumber": null,
  109. "columnType": null,
  110. "align": null
  111. },
  112. {
  113. "tableId": "common1001",
  114. "tableName": "common",
  115. "columnProp": "ipaddress",
  116. "columnLabel": "打印机地址",
  117. "columnHidden": false,
  118. "columnImage": false,
  119. "columnSortable": false,
  120. "columnWidth": '20%',
  121. "format": null,
  122. "functionId": this.$route.meta.menuId,
  123. "sortLv": 0,
  124. "status": true,
  125. "fixed": false,
  126. "serialNumber": null,
  127. "columnType": null,
  128. "align": null
  129. },
  130. {
  131. "tableId": "common1001",
  132. "tableName": "common",
  133. "columnProp": "newprintername",
  134. "columnLabel": "打印机名称",
  135. "columnHidden": false,
  136. "columnImage": false,
  137. "columnSortable": false,
  138. "columnWidth": '50%',
  139. "format": null,
  140. "functionId": this.$route.meta.menuId,
  141. "sortLv": 0,
  142. "status": true,
  143. "fixed": false,
  144. "serialNumber": null,
  145. "columnType": null,
  146. "align": null
  147. },
  148. ],
  149. buttons: {
  150. settingPrint: "设置打印机",
  151. operate: "操作",
  152. select: "查询",
  153. },
  154. buttonList: []
  155. }
  156. },
  157. components: {PrintList,},
  158. mounted() {
  159. this.$nextTick(() => {
  160. this.height = (window.innerHeight * 0.82);
  161. })
  162. },
  163. activated() {
  164. this.getDataList()
  165. },
  166. methods: {
  167. // 初始化
  168. init() {
  169. this.visible = true
  170. this.getDataList()
  171. },
  172. // 获取数据列表
  173. getDataList() {
  174. let query = {
  175. userid: this.$store.state.user.name,
  176. reportfile: this.reportfile
  177. }
  178. getUserLabelPrintList(query).then(({data}) => {
  179. if (data.code === 0) {
  180. this.dataList = data.dataList
  181. }
  182. this.dataListLoading = false
  183. })
  184. },
  185. // 设置打印机
  186. printSetting(row) {
  187. // 转换参数, 避免值传递
  188. let rowData = JSON.parse(JSON.stringify(row))
  189. this.printListVisible = true
  190. this.$nextTick(() => {
  191. this.$refs.printListRef.init(rowData)
  192. })
  193. },
  194. // 保存打印机
  195. savePrint() {
  196. }
  197. },
  198. created() {
  199. }
  200. }
  201. </script>