TabelTransfer.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. <template>
  2. <el-container>
  3. <el-header height="">
  4. <el-form label-width="0" :inline="false" size="small">
  5. <el-row :gutter="20">
  6. <el-col :xs="24" :sm="8" :lg="8" :offset="0">
  7. <el-form-item label="" >
  8. <el-input
  9. v-model="input"
  10. placeholder="产品编码"
  11. ></el-input>
  12. </el-form-item>
  13. </el-col>
  14. <el-col :xs="24" :sm="8" :lg="8" :offset="0">
  15. <el-form-item label="" >
  16. <el-input
  17. v-model="input"
  18. placeholder="产品名称"
  19. ></el-input>
  20. </el-form-item>
  21. </el-col>
  22. <el-col :xs="24" :sm="8" :lg="8" :offset="0">
  23. <el-form-item label="" >
  24. <el-input
  25. v-model="input"
  26. placeholder="产品型号"
  27. ></el-input>
  28. </el-form-item>
  29. </el-col>
  30. <el-col :xs="24" :sm="8" :lg="8" :offset="0">
  31. <el-form-item label="" >
  32. <el-date-picker
  33. v-model="value1"
  34. type="datetimerange"
  35. range-separator="至"
  36. start-placeholder="开始日期"
  37. end-placeholder="结束日期"
  38. >
  39. </el-date-picker>
  40. </el-form-item>
  41. </el-col>
  42. <el-form-item label="" >
  43. <el-button type="primary" size="small " @click=""
  44. >查询</el-button
  45. >
  46. </el-form-item>
  47. </el-row>
  48. </el-form>
  49. </el-header>
  50. <el-main height="">
  51. <el-row>
  52. <el-row :gutter="50">
  53. <el-col :xs="10" :ms="10" :lg="10">
  54. <el-row>
  55. <el-row> </el-row>
  56. <el-row>
  57. <el-row class="title"> 可选产品列表 </el-row>
  58. <el-table style="width: 100%" :data="tableData" border>
  59. <el-table-column type="selection" width="55" align="center">
  60. </el-table-column>
  61. <el-table-column label="日期" width="120" align="center">
  62. <template slot-scope="scope">{{ scope.row.date }}</template>
  63. </el-table-column>
  64. <el-table-column prop="name" label="姓名" align="center">
  65. </el-table-column>
  66. </el-table>
  67. <el-row class="mg">
  68. <Pagination />
  69. </el-row>
  70. </el-row>
  71. </el-row>
  72. </el-col>
  73. <el-col :xs="4" :ms="4" :lg="4" class="middle">
  74. <el-row :gutter="20" justify="center" align="middle">
  75. <el-row class="btn">
  76. <el-button type="primary" size="small " @click=""
  77. >全部添加</el-button
  78. >
  79. </el-row>
  80. <el-row class="btn">
  81. <el-button type="primary" size="small " @click=""
  82. >增加</el-button
  83. >
  84. </el-row>
  85. <el-row class="btn">
  86. <el-button type="primary" size="small " @click=""
  87. >删除</el-button
  88. ></el-row
  89. >
  90. <el-row class="btn"
  91. ><el-button type="primary" size="small " @click=""
  92. >全部删除</el-button
  93. ></el-row
  94. >
  95. </el-row>
  96. </el-col>
  97. <el-col :xs="10" :ms="10" :lg="10">
  98. <el-row>
  99. <el-row> </el-row>
  100. <el-row>
  101. <el-row class="title"> 已选产品列表 </el-row>
  102. <el-table style="width: 100%" :data="tableData" border>
  103. <el-table-column type="selection" width="55" align="center">
  104. </el-table-column>
  105. <el-table-column label="日期" width="120" align="center">
  106. <template slot-scope="scope">{{ scope.row.date }}</template>
  107. </el-table-column>
  108. <el-table-column prop="name" label="姓名" align="center">
  109. </el-table-column>
  110. </el-table>
  111. <el-row class="mg">
  112. <Pagination />
  113. </el-row>
  114. </el-row>
  115. </el-row>
  116. </el-col>
  117. </el-row>
  118. </el-row>
  119. </el-main>
  120. </el-container>
  121. </template>
  122. <script>
  123. import Pagination from "./Pagination";
  124. export default {
  125. data() {
  126. return {
  127. input: "",
  128. leftData: [],
  129. rightData: [],
  130. centerDialogVisible: false,
  131. value1: [new Date(2000, 10, 10, 10, 10), new Date(2000, 10, 11, 10, 10)],
  132. tableData: [
  133. {
  134. date: "2016-05-03",
  135. name: "王小虎",
  136. address: "上海市普陀区金沙江路 1518 弄",
  137. },
  138. {
  139. date: "2016-05-02",
  140. name: "王小虎",
  141. address: "上海市普陀区金沙江路 1518 弄",
  142. },
  143. {
  144. date: "2016-05-04",
  145. name: "王小虎",
  146. address: "上海市普陀区金沙江路 1518 弄",
  147. },
  148. {
  149. date: "2016-05-01",
  150. name: "王小虎",
  151. address: "上海市普陀区金沙江路 1518 弄",
  152. },
  153. {
  154. date: "2016-05-08",
  155. name: "王小虎",
  156. address: "上海市普陀区金沙江路 1518 弄",
  157. },
  158. {
  159. date: "2016-05-06",
  160. name: "王小虎",
  161. address: "上海市普陀区金沙江路 1518 弄",
  162. },
  163. {
  164. date: "2016-05-07",
  165. name: "王小虎",
  166. address: "上海市普陀区金沙江路 1518 弄",
  167. },
  168. ],
  169. leftData: [],
  170. dataL: [1, 3, 2],
  171. dataR: [],
  172. rightData: [],
  173. multipleSelection: [],
  174. };
  175. },
  176. methods: {
  177. handelLeftCheck(e) {
  178. console.log(e);
  179. },
  180. handelLeftCheck(direction) {},
  181. //添加全部数据
  182. handleAllData(direction) {
  183. if (direction === "left") {
  184. if (!this.dataL.length) return;
  185. this.dataR = [...this.dataR, ...this.dataL];
  186. this.dataL = [];
  187. this.leftData = [];
  188. } else {
  189. if (!this.dataR.length) return;
  190. this.dataL = [...this.dataL, ...this.dataR];
  191. this.dataR = [];
  192. this.rightData = [];
  193. }
  194. },
  195. //添加部分或单个数据
  196. handlePartData(direction) {
  197. if (direction === "left") {
  198. if (!this.dataL.length) return;
  199. this.dataR = [...this.dataR, ...this.leftData];
  200. this.dataL.forEach((k, d) => {
  201. this.leftData.forEach((e) => {
  202. if (e == k) {
  203. this.dataL.splice(d, 1);
  204. this.leftData = [];
  205. return;
  206. }
  207. });
  208. });
  209. } else {
  210. if (!this.dataL.length) return;
  211. this.dataL = [...this.dataL, ...this.rightData];
  212. this.dataR.forEach((k, d) => {
  213. this.rightData.forEach((e) => {
  214. if (e == k) {
  215. this.dataR.splice(d, 1);
  216. this.rightData = [];
  217. return;
  218. }
  219. });
  220. });
  221. }
  222. },
  223. //删除全部数据
  224. handleAllDelete(direction) {
  225. if (direction === "left") {
  226. if (!this.dataL.length) return;
  227. this.dataL = [];
  228. this.leftData = [];
  229. } else {
  230. if (!this.dataR.length) return;
  231. this.dataR = [];
  232. this.rightData = [];
  233. }
  234. },
  235. //删除部分或单个数据
  236. handlePartDelete(direction) {
  237. if (direction === "left") {
  238. this.dataL.forEach((k, d) => {
  239. this.leftData.forEach((e) => {
  240. if (e == k) {
  241. this.dataL.splice(d, 1);
  242. this.leftData = [];
  243. return;
  244. }
  245. });
  246. });
  247. } else {
  248. this.dataR.forEach((k, d) => {
  249. this.rightData.forEach((e) => {
  250. if (e == k) {
  251. this.dataR.splice(d, 1);
  252. this.rightData = [];
  253. return;
  254. }
  255. });
  256. });
  257. }
  258. },
  259. // 判断能操作那边框
  260. handleJudge(type) {
  261. if (this.leftDisabled) {
  262. // 左边框功能操作
  263. this.hanleType(type, "left");
  264. } else {
  265. // 右边框功能操作
  266. this.hanleType(type, "right");
  267. }
  268. },
  269. // 获取事件类型
  270. hanleType(type, direction) {
  271. switch (type) {
  272. case "AddAll":
  273. this.handleAllData(direction);
  274. break;
  275. case "AddPart":
  276. this.handlePartData(direction);
  277. break;
  278. case "DeleteAll":
  279. this.handleAllDelete(direction);
  280. break;
  281. case "DeletePart":
  282. this.handlePartDelete(direction);
  283. break;
  284. }
  285. },
  286. },
  287. components: {
  288. Pagination,
  289. },
  290. };
  291. </script>
  292. <style lang="scss" scoped>
  293. .btn {
  294. margin: 20px 0;
  295. text-align: center;
  296. }
  297. .query_btn {
  298. margin-left: 0;
  299. }
  300. .mg {
  301. margin: 20px;
  302. }
  303. .pdt {
  304. margin: 20px 0;
  305. }
  306. .el-main {
  307. overflow: hidden;
  308. }
  309. .middle {
  310. height: 430px;
  311. display: flex;
  312. align-content: center;
  313. justify-content: center;
  314. align-items: center;
  315. }
  316. .title {
  317. padding: 10px 0;
  318. text-align: center;
  319. border-left: 1px solid #ebeef5;
  320. border-right: 1px solid #ebeef5;
  321. border-top: 1px solid #ebeef5;
  322. }
  323. </style>