plm前端
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.

214 lines
5.2 KiB

1 year ago
1 year ago
1 year ago
  1. <template>
  2. <el-dialog append-to-body title="查询人员"
  3. :close-on-click-modal="false" :close-on-press-escape="false"
  4. @close="closeDialog"
  5. :visible.sync="visible"
  6. width="685px" v-drag>
  7. <el-form label-position="top"
  8. inline="inline"
  9. size="mini"
  10. label-width="120px">
  11. <el-form-item label="编码" >
  12. <el-input v-model="param1"></el-input>
  13. </el-form-item>
  14. <el-form-item label="名称" >
  15. <el-input v-model="param2"></el-input>
  16. </el-form-item>
  17. <el-button style="margin-top: 18px" type="primary" @click="getDataList(false)">查询
  18. </el-button>
  19. </el-form>
  20. <el-table
  21. :height="height"
  22. :data="dataList"
  23. border
  24. @row-dblclick="getRowData"
  25. v-loading="dataListLoading"
  26. style="width: 100%;">
  27. <el-table-column
  28. v-for="(item,index) in columnList" :key="index"
  29. :sortable="item.columnSortable"
  30. :prop="item.columnProp"
  31. :header-align="item.headerAlign"
  32. :show-overflow-tooltip="item.showOverflowTooltip"
  33. :align="item.align"
  34. :fixed="item.fixed==''?false:item.fixed"
  35. :min-width="item.columnWidth"
  36. :label="item.columnLabel">
  37. <template slot-scope="scope">
  38. {{ scope.row[item.columnProp] }}
  39. </template>
  40. </el-table-column>
  41. </el-table>
  42. <span slot="footer" class="dialog-footer">
  43. <el-button @click="closeModel()" type="primary">关闭</el-button>
  44. </span>
  45. </el-dialog>
  46. </template>
  47. <script>
  48. import {
  49. getChooselist,
  50. getChooselistData
  51. } from "@/api/chooselist/chooselist.js"
  52. export default {
  53. data() {
  54. return {
  55. height: 200,
  56. tagNo: '',
  57. title: '列表',
  58. columnList: [
  59. {
  60. columnProp: "username",
  61. headerAlign: "center",
  62. align: "left",
  63. columnLabel: "编码",
  64. columnHidden: false,
  65. columnImage: false,
  66. columnSortable: false,
  67. sortLv: 0,
  68. status: true,
  69. fixed: '',
  70. columnWidth: 50
  71. },
  72. {
  73. columnProp: "userDisplay",
  74. headerAlign: "center",
  75. align: "left",
  76. columnLabel: "名称",
  77. columnHidden: false,
  78. columnImage: false,
  79. columnSortable: false,
  80. sortLv: 0,
  81. status: true,
  82. fixed: '',
  83. columnWidth: 50
  84. },
  85. {
  86. columnProp: "site",
  87. headerAlign: "center",
  88. align: "left",
  89. columnLabel: "工厂编码",
  90. columnHidden: false,
  91. columnImage: false,
  92. columnSortable: false,
  93. sortLv: 0,
  94. status: true,
  95. fixed: '',
  96. columnWidth: 50
  97. },
  98. {
  99. columnProp: "buNo",
  100. headerAlign: "center",
  101. align: "left",
  102. columnLabel: "BU",
  103. columnHidden: false,
  104. columnImage: false,
  105. columnSortable: false,
  106. sortLv: 0,
  107. status: true,
  108. fixed: '',
  109. columnWidth: 50
  110. },
  111. ],
  112. queryTable: {},
  113. visible: false,
  114. dataListLoading: false,
  115. fullscreenLoading: false,
  116. param1: '',
  117. param2: '',
  118. param3: '',
  119. param: '',
  120. site: '',
  121. conSql: '',
  122. param4: this.$store.state.user.site,
  123. dataList: [],
  124. baseListData: {
  125. caption1: '',
  126. caption2: '',
  127. caption3: '',
  128. caption4: '',
  129. description: '',
  130. fieldname1: '',
  131. fieldname2: '',
  132. sqlcode: '',
  133. tagno: '',
  134. },
  135. defaultParam: false
  136. }
  137. },
  138. methods: {
  139. closeModel(){
  140. this.baseListData={
  141. caption1: '',
  142. caption2: '',
  143. caption3: '',
  144. caption4: '',
  145. description: '',
  146. fieldname1: '',
  147. fieldname2: '',
  148. sqlcode: '',
  149. tagno: '',
  150. }
  151. this.dataList=[];
  152. this.visible = false;
  153. },
  154. // 获取 用户的配置
  155. init(site,conSql,param) {
  156. this.visible = true;
  157. this.site=site
  158. this.param = param===null?'':param
  159. this.conSql = conSql?conSql: ''
  160. // 根据 tagNo 获取列表
  161. this.getDataList(true)
  162. this.dataListLoading = false
  163. },
  164. getDataList (bool) {
  165. let sql = "select a.username,a.user_display userDisplay,b.site,b.bu_no as buNo from sys_user a left join AccessBu b on a.username=b.username where b.bu_no like '"
  166. sql += this.conSql+"'"
  167. sql += " and b.site = '" + this.site + "'"
  168. if (bool) {
  169. sql += " and (a.username like '%" + this.param + "%' OR a.user_display like '%" + this.param + "%'" +" ) "
  170. }
  171. if (this.param1) {
  172. sql += " and a.username like '%" + this.param1 + "%'"
  173. }
  174. if (this.param2) {
  175. sql += " and a.user_display like '%" + this.param2 + "%'"
  176. }
  177. getChooselistData({"sqlcode": sql}).then(({data}) => {
  178. if (data.code == 0) {
  179. this.dataList = data.baseListData
  180. } else {
  181. this.$message.error(data.msg)
  182. }
  183. })
  184. },
  185. getRowData (row) {
  186. this.visible = false
  187. this.$emit('getBaseData',row)
  188. },
  189. closeDialog () {
  190. this.dataList = []
  191. }
  192. }
  193. }
  194. </script>
  195. <style>
  196. </style>