entrustedDialog.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. <template>
  2. <el-dialog
  3. title="受托收货单"
  4. :visible.sync="entrustedVisible"
  5. :before-close="handleClose"
  6. :close-on-click-modal="true"
  7. :close-on-press-escape="false"
  8. append-to-body
  9. width="60%"
  10. @onDone="onDone"
  11. >
  12. <div>
  13. <el-row>
  14. <el-col :span="24" class="topsearch">
  15. <el-form :inline="true" :model="formInline" class="demo-form-inline">
  16. <el-form-item label="产品名称:">
  17. <el-input
  18. clearable
  19. v-model="formInline.productName"
  20. placeholder="产品名称"
  21. ></el-input>
  22. </el-form-item>
  23. <el-form-item label="产品编码:">
  24. <el-input
  25. clearable
  26. v-model="formInline.productCode"
  27. placeholder="产品编码"
  28. ></el-input>
  29. </el-form-item>
  30. <el-button
  31. type="primary"
  32. size="small"
  33. @click="reload"
  34. style="margin-top: 4px"
  35. >搜索</el-button
  36. >
  37. <el-button style="margin-top: 4px" size="small" @click="reset"
  38. >重置</el-button
  39. >
  40. </el-form>
  41. </el-col>
  42. <el-col :span="24" class="table_col">
  43. <ele-pro-table
  44. ref="equiTable"
  45. :columns="columns"
  46. :datasource="datasource"
  47. :selection.sync="selection"
  48. cache-key="systemRoleTable3"
  49. row-key="id"
  50. height="50vh"
  51. >
  52. </ele-pro-table>
  53. </el-col>
  54. </el-row>
  55. </div>
  56. <div class="btns">
  57. <el-button type="primary" size="small" @click="selected">选择</el-button>
  58. <el-button size="small" @click="handleClose">关闭</el-button>
  59. </div>
  60. </el-dialog>
  61. </template>
  62. <script>
  63. const reviewStatus = {
  64. 0: '未提交',
  65. 1: '审核中',
  66. 2: '已审核',
  67. 3: '审核不通过',
  68. 7: '作废'
  69. };
  70. // import AssetTree from '@/components/AssetTree/index.vue';
  71. import { entrustedList } from '@/api/classifyManage';
  72. export default {
  73. // components: {
  74. // AssetTree
  75. // },
  76. props: {
  77. selectList: Array,
  78. type: {
  79. default: 2 //1多选 2单选
  80. },
  81. isAll: {
  82. default: false
  83. },
  84. entrustedVisible: {
  85. type: Boolean,
  86. default: false
  87. }
  88. },
  89. data() {
  90. return {
  91. columns: [
  92. {
  93. width: 45,
  94. type: 'selection',
  95. columnKey: 'selection',
  96. align: 'center',
  97. reserveSelection: true
  98. },
  99. {
  100. columnKey: 'index',
  101. label: '序号',
  102. type: 'index',
  103. width: 55,
  104. align: 'center',
  105. showOverflowTooltip: true
  106. },
  107. {
  108. prop: 'orderNo',
  109. label: '销售订单编码',
  110. align: 'center',
  111. slot: 'orderNo',
  112. showOverflowTooltip: true,
  113. sortable: true,
  114. minWidth: 200
  115. },
  116. {
  117. prop: 'productName',
  118. label: '产品名称',
  119. align: 'center',
  120. showOverflowTooltip: true,
  121. minWidth: 140
  122. },
  123. {
  124. prop: 'productCode',
  125. label: '产品编码',
  126. align: 'center',
  127. showOverflowTooltip: true,
  128. minWidth: 190
  129. },
  130. {
  131. prop: 'batchNo',
  132. label: '批次号',
  133. align: 'center',
  134. showOverflowTooltip: true,
  135. minWidth: 140
  136. },
  137. {
  138. prop: 'totalCount',
  139. label: '订单总数量',
  140. align: 'center',
  141. showOverflowTooltip: true,
  142. minWidth: 140
  143. },
  144. {
  145. prop: 'produceType',
  146. label: '生产类型',
  147. align: 'center',
  148. showOverflowTooltip: true,
  149. minWidth: 180
  150. },
  151. {
  152. prop: 'productBrand',
  153. label: '产品牌号',
  154. align: 'center',
  155. showOverflowTooltip: true,
  156. minWidth: 120
  157. },
  158. {
  159. prop: 'createTime',
  160. label: '创建时间',
  161. align: 'center',
  162. showOverflowTooltip: true,
  163. minWidth: 170
  164. }
  165. ],
  166. tableList: [],
  167. selection: [],
  168. formInline: {
  169. productCode: '',
  170. productName: ''
  171. }
  172. };
  173. },
  174. watch: {},
  175. mounted() {
  176. console.log(this.entrustedVisible, '12345');
  177. // this.entrustedVisible = true;
  178. },
  179. methods: {
  180. async datasource({ page, limit }) {
  181. const params = {
  182. pageNum: page,
  183. size: limit,
  184. ...this.formInline
  185. };
  186. const data = await entrustedList(params);
  187. console.log(data, 'data');
  188. this.tableList = data.list;
  189. return data;
  190. },
  191. // open(ids) {
  192. // this.entrustedVisible = true;
  193. // if (ids) {
  194. // this.ids = ids;
  195. // }
  196. // },
  197. reload() {
  198. this.$refs.equiTable.reload();
  199. },
  200. handleClose() {
  201. // this.entrustedVisible = false;
  202. this.formInline = {
  203. productCode: '',
  204. productName: ''
  205. };
  206. this.$emit('closeEntrusted');
  207. // this.$refs.equiTable.clearSelection();
  208. },
  209. reset() {
  210. this.formInline = {
  211. productCode: '',
  212. productName: ''
  213. };
  214. this.reload();
  215. },
  216. onDone() {
  217. this.$nextTick(() => {
  218. this.$refs.equiTable.setSelectedRowKeys(this.ids);
  219. });
  220. },
  221. // 选择
  222. selected() {
  223. if (this.selection.length == 0) {
  224. return this.$message.warning('请选择一条数据');
  225. }
  226. if (this.selection.length > 1 && this.type == 2) {
  227. return this.$message.warning('只能选择一条数据');
  228. }
  229. this.formInline = {
  230. productCode: '',
  231. productName: ''
  232. };
  233. this.$emit('choose', this.selection[0]);
  234. this.handleClose();
  235. }
  236. }
  237. };
  238. </script>
  239. <style lang="scss" scoped>
  240. .tree_col {
  241. border: 1px solid #eee;
  242. padding: 10px 0;
  243. box-sizing: border-box;
  244. max-height: 530px;
  245. overflow: auto;
  246. }
  247. .table_col {
  248. padding-left: 10px;
  249. ::v-deep .el-table th.el-table__cell {
  250. background: #f2f2f2;
  251. }
  252. }
  253. .pagination {
  254. text-align: right;
  255. padding: 10px 0;
  256. }
  257. .btns {
  258. text-align: right;
  259. padding: 10px 0;
  260. }
  261. .topsearch {
  262. margin-bottom: 15px;
  263. }
  264. </style>