toolList.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <template>
  2. <ele-modal width="60%" :visible.sync="visible" :close-on-click-modal="false" custom-class="ele-dialog-form"
  3. append-to-body :maxable="true" :resizable="true">
  4. <!-- <div class="ele-body" style="height:60vh;overflow: auto;"> -->
  5. <!-- <el-card shadow="never" v-loading="loading"> -->
  6. <!-- <ele-split-layout
  7. width="210px"
  8. allow-collapse
  9. :right-style="{ overflow: 'hidden' }"
  10. >
  11. <div class="ele-border-lighter sys-organization-list">
  12. <el-tree
  13. ref="tree"
  14. :data="data"
  15. highlight-current
  16. :draggable="true"
  17. node-key="id"
  18. :expand-on-click-node="false"
  19. :default-expand-all="true"
  20. @node-click="onNodeClick"
  21. >
  22. </el-tree>
  23. </div> -->
  24. <!-- <template v-slot:content> -->
  25. <ele-pro-table ref="table" :columns="columns" :datasource="useList" tool-class="ele-toolbar-form"
  26. :needPage="false" row-key="id" :selection.sync="selection" >
  27. <template v-slot:toolbar v-if="type != 'detail'">
  28. <el-button type="primary" @click="fileShow = true">选择质检工具</el-button>
  29. </template>
  30. <template v-slot:action="{ row }">
  31. <el-popconfirm
  32. class="ele-action"
  33. title="确定要删除吗?"
  34. @confirm="remove(row)"
  35. >
  36. <template v-slot:reference v-if="type != 'detail'">
  37. <el-link type="danger" :underline="false" icon="el-icon-delete">
  38. 删除
  39. </el-link>
  40. </template>
  41. </el-popconfirm>
  42. </template>
  43. </ele-pro-table>
  44. <!-- </template> -->
  45. <!-- </ele-split-layout> -->
  46. <!-- </el-card> -->
  47. <!-- </div> -->
  48. <template v-slot:footer>
  49. <el-button @click="visible = false">取消</el-button>
  50. <el-button type="primary" @click="addUserToolList"> 确认 </el-button>
  51. </template>
  52. <ele-modal width="60%" :visible.sync="fileShow" :close-on-click-modal="false" custom-class="ele-dialog-form"
  53. append-to-body :maxable="true" :resizable="true">
  54. <ele-pro-table ref="table" :columns="columns" :datasource="datasource" tool-class="ele-toolbar-form"
  55. height="500px"
  56. :needPage="false" row-key="id" :selection.sync="selection" :toolbar="false">
  57. </ele-pro-table>
  58. <template v-slot:footer>
  59. <el-button @click="fileShow = false">取消</el-button>
  60. <el-button type="primary" @click="addTemplate"> 确认 </el-button>
  61. </template>
  62. </ele-modal>
  63. </ele-modal>
  64. </template>
  65. <script>
  66. export default {
  67. data() {
  68. return {
  69. selection: [],
  70. loading: false,
  71. fileShow: false,
  72. visible: false,
  73. datasource: [],
  74. useList: [],
  75. columns: [
  76. {
  77. width: 45,
  78. type: 'selection',
  79. columnKey: 'selection',
  80. align: 'center'
  81. },
  82. {
  83. columnKey: 'index',
  84. type: 'index',
  85. width: 50,
  86. align: 'center',
  87. label: '序号',
  88. showOverflowTooltip: true,
  89. fixed: 'left'
  90. },
  91. {
  92. prop: 'code',
  93. label: '物品编码',
  94. align: 'center',
  95. showOverflowTooltip: true
  96. },
  97. {
  98. slot: 'name',
  99. prop: 'name',
  100. label: '物品名称',
  101. align: 'center',
  102. showOverflowTooltip: true,
  103. minWidth: 200
  104. },
  105. {
  106. prop: 'brandNum',
  107. label: '牌号',
  108. align: 'center',
  109. showOverflowTooltip: true
  110. },
  111. {
  112. prop: 'categoryModel',
  113. label: '型号',
  114. align: 'center',
  115. showOverflowTooltip: true
  116. },
  117. {
  118. prop: 'specification',
  119. label: '规格',
  120. align: 'center',
  121. showOverflowTooltip: true
  122. },
  123. {
  124. columnKey: 'action',
  125. label: '操作',
  126. width: 200,
  127. align: 'center',
  128. resizable: false,
  129. slot: 'action',
  130. showOverflowTooltip: true
  131. }
  132. // {
  133. // prop: 'measureQuantity',
  134. // label: '计量数量',
  135. // sortable: 'custom',
  136. // showOverflowTooltip: true,
  137. // width: 130,
  138. // align: 'center'
  139. // },
  140. // {
  141. // prop: 'measureUnit',
  142. // label: '计量单位',
  143. // align: 'center'
  144. // },
  145. // {
  146. // prop: 'weight',
  147. // label: '重量',
  148. // showOverflowTooltip: true
  149. // },
  150. // {
  151. // prop: 'weightUnit',
  152. // label: '重量单位',
  153. // showOverflowTooltip: true
  154. // },
  155. ],
  156. data: [],
  157. type:''
  158. }
  159. },
  160. methods: {
  161. open(val, type, sList) {
  162. this.visible = true;
  163. this.type = type;
  164. this.useList = val;
  165. this.datasource = sList;
  166. },
  167. addUserToolList() {
  168. // if (this.selection.some((item) =>
  169. // this.useList.some((i) => i.code == item.code))) {
  170. // return this.$message.error('选择的物品已经存在列表了');
  171. // }
  172. this.$emit(
  173. 'success',
  174. this.useList
  175. );
  176. this.visible = false;
  177. this.init();
  178. },
  179. addTemplate() {
  180. this.useList = this.selection;
  181. this.fileShow = false;
  182. },
  183. remove(row) {
  184. this.useList = this.useList.filter((item) => item.code != row.code);
  185. },
  186. init() {
  187. this.selection = [];
  188. }
  189. },
  190. }
  191. </script>