Vue组件-列表形式穿梭框

组件:公共 ShuttleBox

image.png

  1. <!----------------------------------------------------------------------------
  2. @description:列表形式穿梭框
  3. @author:王浩
  4. @date:Created in 2022/1/20 11:46
  5. @modified By:
  6. @version: 1.0.0
  7. ---------------------------------------------------------------------------->
  8. <template>
  9. <div class="shuttle-box" :style="{ height }">
  10. <div class="shuttle-box-left">
  11. <p>{{ titleObj.leftTitle }}</p>
  12. <div class="shuttle-box-content">
  13. <slot name="left" />
  14. </div>
  15. </div>
  16. <div class="shuttle-box-center">
  17. <sg-button @click="toRight" :disabled="disabledLeft" type="primary" size="mini" icon="sg-icon-d-arrow-left" />
  18. <sg-button @click="toLeft" type="primary" size="mini" icon="sg-icon-d-arrow-right" />
  19. </div>
  20. <div class="shuttle-box-right">
  21. <p>{{ titleObj.rightTitle }}</p>
  22. <div class="shuttle-box-content">
  23. <slot name="right" />
  24. </div>
  25. </div>
  26. </div>
  27. </template>
  28. <script>
  29. export default {
  30. name: "ShuttleBox",
  31. props: {
  32. /**
  33. * @description:穿梭框的高度
  34. */
  35. height: {
  36. type: String,
  37. default: "460px",
  38. },
  39. /**
  40. * @description:禁用到到右去按钮
  41. */
  42. disabledLeft: {
  43. type: Boolean,
  44. default: false,
  45. },
  46. /**
  47. * @description:禁用到到左去按钮
  48. */
  49. disabledRight: {
  50. type: Boolean,
  51. default: false,
  52. },
  53. /**
  54. * @description:左右两侧标题
  55. */
  56. titleObj: {
  57. type: Object,
  58. default: () => {
  59. return {
  60. leftTitle: "选择数据",
  61. rightTitle: "已选择数据",
  62. };
  63. },
  64. },
  65. },
  66. data() {
  67. return {};
  68. },
  69. methods: {
  70. toRight() {
  71. this.$emit("toRight");
  72. },
  73. toLeft() {
  74. this.$emit("toLeft");
  75. },
  76. },
  77. };
  78. </script>
  79. <style scoped lang="scss">
  80. $_WIDTH_100: 100%;
  81. .shuttle-box {
  82. width: $_WIDTH_100;
  83. background-color: rgba(255, 255, 255, 1);
  84. display: flex;
  85. &-left {
  86. width: calc((#{$_WIDTH_100} - 90px) / 2);
  87. }
  88. &-center {
  89. width: 200px;
  90. display: flex;
  91. flex-direction: column;
  92. justify-content: center;
  93. align-items: center;
  94. button:first-child {
  95. margin-bottom: 20px;
  96. }
  97. /deep/ .sg-button {
  98. margin-left: 0;
  99. color: #ffffff;
  100. font-size: 20px;
  101. font-weight: 900;
  102. }
  103. }
  104. &-right {
  105. width: calc((#{$_WIDTH_100} - 400px) / 2);
  106. }
  107. .shuttle-box-left,
  108. .shuttle-box-right {
  109. width: 100%;
  110. border-radius: 8px;
  111. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.08);
  112. padding-left: 10px;
  113. padding-right: 10px;
  114. p {
  115. height: 40px;
  116. line-height: 40px;
  117. margin-block-start: 0;
  118. margin-block-end: 0;
  119. margin-inline-start: 0;
  120. margin-inline-end: 0;
  121. }
  122. .shuttle-box-content {
  123. width: 100%;
  124. margin-top: 12px;
  125. height: calc(100% - 40px - 12px - 12px);
  126. }
  127. }
  128. }
  129. </style>

在组件中引用:shuttle_box.vue

  1. <template>
  2. <div>
  3. <div>
  4. <div class="level">
  5. <!-- 左边框框 -->
  6. <div class="transferbox">
  7. <div class="topbox">
  8. <span style="color:#1E90FF;font-size:16px;font-weight: 550;">待选设备</span>
  9. </div>
  10. <div class="level searchbox">
  11. <el-input v-model="input" placeholder="请输入内容" style="width:300px" />
  12. <el-button type="primary" style="margin:0 0 0 20px">搜索</el-button>
  13. </div>
  14. <el-table
  15. ref="multipleTable"
  16. :data="currentPageData"
  17. highlight-current-row
  18. tooltip-effect="dark"
  19. height="460"
  20. style="width: 100%;height:460px;cursor:pointer;"
  21. :row-style="setColor"
  22. @current-change="lineClick"
  23. >
  24. <el-table-column
  25. label="日期"
  26. width="430"
  27. >
  28. <template slot-scope="scope">{{ scope.row.date }}</template>
  29. </el-table-column>
  30. </el-table>
  31. <!-- 分页 -->
  32. <el-pagination
  33. :current-page="listForm.currentPage"
  34. :page-sizes="[5,10,25,50,100,200]"
  35. :page-size="listForm.pageSize"
  36. layout="total, sizes, prev, pager, next, jumper"
  37. :total="totalSize"
  38. style="margin-bottom:10px;margin-top:16px"
  39. @size-change="handleSizeChange"
  40. @current-change="handleCurrentChange"
  41. />
  42. </div>
  43. <!-- 中间按钮 -->
  44. <div class="vertical center3 centrebtn">
  45. <el-button type="primary" icon="el-icon-arrow-right" @click="singleSel()" />
  46. <el-button type="primary" style="margin:20px 0 0 0" icon="el-icon-d-arrow-right" @click="mutiSel()" />
  47. </div>
  48. <!-- 右边框框 -->
  49. <div class="transferbox">
  50. <div class="topbox">
  51. <span style="color:#1E90FF;font-size:16px;font-weight: 550;">已选设备</span>
  52. </div>
  53. <el-table
  54. ref="multipleTable"
  55. :data="yxData"
  56. tooltip-effect="dark"
  57. height="500"
  58. style="width: 100%;height:500px;cursor:pointer;"
  59. >
  60. <el-table-column
  61. label="日期"
  62. width="360"
  63. >
  64. <template slot-scope="scope">{{ scope.row.date }}</template>
  65. </el-table-column>
  66. <el-table-column label="操作" width="70">
  67. <template slot-scope="scope">
  68. <div>
  69. <span class="look" style="color: #FF0000" title @click="deletedetails(scope.row)">删除</span>
  70. </div>
  71. </template>
  72. </el-table-column>
  73. </el-table>
  74. </div>
  75. </div>
  76. <div class="dialog-btn">
  77. <el-button>取消</el-button>
  78. <el-button type="primary">确定</el-button>
  79. </div>
  80. </div>
  81. </div>
  82. </template>
  83. <script>
  84. export default {
  85. data() {
  86. return {
  87. // 分页
  88. listForm: {
  89. name: '',
  90. type: '',
  91. currentPage: 1,
  92. pageSize: 25,
  93. placeName: '',
  94. eui: ''
  95. },
  96. totalSize: 0,
  97. input: '',
  98. currentPageData: [{
  99. date: '2016-05-03'
  100. }, {
  101. date: '2016-05-02'
  102. }, {
  103. date: '2016-05-04'
  104. }, {
  105. date: '2016-05-01'
  106. }, {
  107. date: '2016-05-04'
  108. }, {
  109. date: '2016-05-01'
  110. }
  111. ],
  112. multipleSelection: [],
  113. currentRowData: null,
  114. yxData: []
  115. }
  116. },
  117. // 生命周期 - 挂载完成(可以访问DOM元素)
  118. mounted() {
  119. },
  120. methods: {
  121. // 页容量改变
  122. handleSizeChange(val) {
  123. console.log(val)
  124. this.listForm.pageSize = val
  125. this.deviceList()
  126. },
  127. // 改变当前页
  128. handleCurrentChange(val) {
  129. console.log(val)
  130. this.listForm.currentPage = val
  131. this.deviceList()
  132. },
  133. // 选中
  134. lineClick(val) {
  135. console.log(val)
  136. this.currentRowData = val
  137. },
  138. // 单选
  139. singleSel() {
  140. if (this.currentRowData !== null) {
  141. if (JSON.stringify(this.yxData).indexOf(JSON.stringify(this.currentRowData)) === -1) {
  142. this.yxData.push(this.currentRowData)
  143. }
  144. }
  145. },
  146. // 选择整个页面
  147. mutiSel() {
  148. if (this.currentRowData !== null) {
  149. this.currentPageData.forEach((item, index) => {
  150. if (JSON.stringify(this.yxData).indexOf(JSON.stringify(item)) === -1) {
  151. this.yxData.push(item)
  152. this.setColor(item, index)
  153. }
  154. })
  155. }
  156. },
  157. // 删除
  158. deletedetails(row) {
  159. if (JSON.stringify(this.yxData).indexOf(JSON.stringify(row)) !== -1) {
  160. var index = this.yxData.indexOf(row)
  161. this.yxData.splice(index, 1)
  162. }
  163. },
  164. // 选中之后设置颜色
  165. setColor({ row, rowIndex }) {
  166. if (JSON.stringify(this.yxData).indexOf(JSON.stringify(row)) !== -1) {
  167. return {
  168. color: 'red'
  169. }
  170. }
  171. }
  172. }
  173. }
  174. </script>
  175. <style lang="scss" scoped>
  176. .transferbox{
  177. height: 600px;
  178. width: 36%;//右边盒子的宽占比
  179. border: 3px solid #009cde;
  180. .topbox{
  181. margin: 10px 10px;
  182. }
  183. .searchbox{
  184. margin: 0 0 0 10px;
  185. }
  186. }
  187. .centrebtn{
  188. width: 80px;
  189. height: 600px;
  190. margin: 0 10px 0 10px;
  191. background-color: #009cde;
  192. background-image: radial-gradient(circle farthest-side at left bottom,#009cde,#004687c7 125%);
  193. color: #ffff;
  194. }
  195. /* 水平居中 */
  196. .center1{
  197. display: flex;
  198. justify-content: center;
  199. }
  200. /* 垂直居中 */
  201. .center2{
  202. display: flex;
  203. align-items: center;
  204. }
  205. /* 垂直水平居中 */
  206. .center3{
  207. display: flex;
  208. align-items: center;
  209. justify-content: center;
  210. }
  211. /* 水平布局 */
  212. .level{
  213. display: flex;
  214. flex-direction: row;
  215. }
  216. // 垂直布局
  217. .vertical{
  218. display: flex;
  219. flex-direction: column;
  220. }
  221. </style>

demo

image.png

  1. <!--
  2. * @description:
  3. * @author: wanghao
  4. * @Date: 2022-01-24 14:19:20
  5. * @Modified By:
  6. * @version: 1.0.0
  7. -->
  8. <template>
  9. <div class="hello">
  10. <div class="one">
  11. <p v-for="msg in message" @click="clickP(msg)" :key="msg">{{ msg.name }}</p>
  12. </div>
  13. <div class="two">
  14. <p v-for="data in newdatas" @click="deleteP(data)" :key="data">{{ data.name }}</p>
  15. </div>
  16. </div>
  17. </template>
  18. <script>
  19. export default {
  20. data() {
  21. return {
  22. msg: "哈哈",
  23. hh: "呵呵",
  24. message: [
  25. { id: 1, name: "第一个" },
  26. { id: 2, name: "第二个" },
  27. ],
  28. datas: [],
  29. newdatas: [],
  30. };
  31. },
  32. mounted: function () {},
  33. methods: {
  34. clickP: function (msg) {
  35. this.datas.push(msg);
  36. this.newdatas = this.unique(this.datas);
  37. },
  38. deleteP: function (data) {
  39. for (let i = 0; i < this.newdatas.length; i++) {
  40. console.log("输出");
  41. console.log(this.newdatas[i]);
  42. if (this.newdatas[i].id == data.id) {
  43. this.newdatas.splice(i, 1);
  44. this.datas.splice(0, this.datas.length);
  45. }
  46. }
  47. },
  48. // 除重
  49. unique: function (a) {
  50. let res = [];
  51. for (let i = 0, len = a.length; i < len; i++) {
  52. let item = a[i];
  53. res.indexOf(item) === -1 && res.push(item);
  54. }
  55. return res;
  56. },
  57. },
  58. };
  59. </script>
  60. <!-- Add "scoped" attribute to limit CSS to this component only -->
  61. <style scoped>
  62. .hello {
  63. display: flex;
  64. justify-content: center;
  65. }
  66. .one,
  67. .two {
  68. width: 300px;
  69. height: 400px;
  70. outline: 1px solid red;
  71. }
  72. </style>

Vue组件-版本号输入框

组件:公共 VersionNumber

  1. <!----------------------------------------------------------------------------
  2. @description:版本号输入框
  3. @author:张时友
  4. @date:Created in 2022/3/3 16:51
  5. @modified By:
  6. @version: 1.0.0
  7. ---------------------------------------------------------------------------->
  8. <template>
  9. <div class="version-number" :class="disabled ? 'is-disabled' : ''">
  10. <span class="separator" v-if="showV">V</span>
  11. <sg-input
  12. v-model.trim="viewList[0]"
  13. oninput="value=value.replace(/[^\d]/g,'')"
  14. :disabled="disabled"
  15. v-bind="$attrs"
  16. ></sg-input>
  17. <span class="separator">{{ separator }}</span>
  18. <sg-input
  19. v-model.trim="viewList[1]"
  20. oninput="value=value.replace(/[^\d]/g,'')"
  21. :disabled="disabled"
  22. v-bind="$attrs"
  23. ></sg-input>
  24. <span class="separator">{{ separator }}</span>
  25. <sg-input
  26. v-model.trim="viewList[2]"
  27. oninput="value=value.replace(/[^\d]/g,'')"
  28. :disabled="disabled"
  29. v-bind="$attrs"
  30. ></sg-input>
  31. <div class="icon" v-if="showClear" @click="clear()">
  32. <i class="sg-icon-circle-close"></i>
  33. </div>
  34. </div>
  35. </template>
  36. <script>
  37. export default {
  38. name: "versionNumber",
  39. props: {
  40. /**
  41. * @description: v-model绑定的值
  42. * @param {string}
  43. * @default: 1.2.2
  44. * */
  45. value: {
  46. type: String,
  47. default: "",
  48. },
  49. /**
  50. * @description: 每个数字之间的分隔符
  51. * @param {string}
  52. * @default: .
  53. * */
  54. separator: {
  55. type: String,
  56. default: ".",
  57. },
  58. /**
  59. * @description: 是否显示前面的字母V
  60. * @param {boolean}
  61. * @default:true
  62. * */
  63. showV: {
  64. type: Boolean,
  65. default: true,
  66. },
  67. /**
  68. * @description: 是否禁用
  69. * @param {boolean}
  70. * @default:false
  71. * */
  72. disabled: {
  73. type: Boolean,
  74. default: false,
  75. },
  76. /**
  77. * @description: 是否显示清空按钮
  78. * @param {boolean}
  79. * @default:true
  80. * */
  81. clearable: {
  82. type: Boolean,
  83. default: false,
  84. },
  85. },
  86. data() {
  87. return {
  88. viewList: [],
  89. blackValue: "",
  90. isHasV: false,
  91. };
  92. },
  93. computed: {
  94. showClear() {
  95. console.log(this.viewList.length);
  96. if (this.clearable && this.viewList.length > 1) {
  97. return true;
  98. } else {
  99. return false;
  100. }
  101. },
  102. },
  103. created() {
  104. this.init();
  105. },
  106. methods: {
  107. /**
  108. * @description:初始化数据
  109. * @param ,
  110. * @returns null
  111. **/
  112. init() {
  113. this.viewList = ["", "", ""];
  114. this.blackValue = this.value;
  115. const _C = this.blackValue.charCodeAt(0);
  116. if ((_C >= 65 && _C <= 90) || (_C >= 97 && _C <= 122)) {
  117. this.blackValue = this.blackValue.substring(1);
  118. this.isHasV = true;
  119. }
  120. this.viewList = this.blackValue.split(this.separator);
  121. },
  122. /**
  123. * @description:处理数据给父元素
  124. * @param ,
  125. * @returns null
  126. **/
  127. valueHandler() {
  128. let list = this.viewList;
  129. if (this.isHasV) {
  130. return "V" + list.join(this.separator);
  131. }
  132. return list.join(this.separator);
  133. },
  134. /**
  135. * @description:清空事件
  136. * @param ,
  137. * @returns null
  138. **/
  139. clear() {
  140. this.viewList = [];
  141. },
  142. },
  143. watch: {
  144. value() {
  145. this.init();
  146. },
  147. /**
  148. * @description:将数据绑定给v-model
  149. * @param ,
  150. * @returns null
  151. **/
  152. viewList: {
  153. deep: true,
  154. handler() {
  155. this.$emit("input", this.valueHandler());
  156. },
  157. },
  158. },
  159. };
  160. </script>
  161. <style scoped lang="scss">
  162. .version-number {
  163. width: 100%;
  164. border: 1px solid #d9d9d9;
  165. display: flex;
  166. background-color: #ffffff;
  167. /deep/ .sg-input__inner {
  168. border: 0;
  169. border-radius: 0;
  170. }
  171. .separator {
  172. padding: 0 10px;
  173. }
  174. .icon {
  175. box-sizing: content-box;
  176. padding: 0 12px;
  177. visibility: hidden;
  178. }
  179. }
  180. .version-number:hover .icon {
  181. visibility: visible;
  182. cursor: pointer;
  183. }
  184. .is-disabled {
  185. background-color: #eee;
  186. }
  187. </style>

在组件中引用:other.vue

image.png

  1. <!----------------------------------------------------------------------------
  2. @description:小功能性组件
  3. @author:王浩
  4. @date:Created in 2022/3/4 09:28
  5. @modified By:
  6. @version: 1.0.0
  7. ---------------------------------------------------------------------------->
  8. <template>
  9. <div class="other">
  10. <sg-row>
  11. <sg-col :span="8">
  12. <div>{{ form }}</div>
  13. <sg-form :rules="rules" ref="ruleForm" :model="form" label-width="100px">
  14. <sg-form-item label="版本号" prop="vn">
  15. <VersionNumber v-model="form.vn" clearable :disabled="false" />
  16. </sg-form-item>
  17. <sg-form-item>
  18. <sg-button type="primary" @click="submitForm('ruleForm')">立即创建</sg-button>
  19. </sg-form-item>
  20. </sg-form>
  21. </sg-col>
  22. </sg-row>
  23. </div>
  24. </template>
  25. <script>
  26. import VersionNumber from "_c/VersionNumber/index";
  27. import * as valid from "@/utils/rules";
  28. export default {
  29. name: "Other",
  30. components: {
  31. VersionNumber,
  32. },
  33. data() {
  34. return {
  35. form: {
  36. vn: "0.0.3",
  37. },
  38. rules: {
  39. vn: [
  40. { required: true, message: "请输入活动名称", trigger: "blur" },
  41. { validator: valid.numberValidUppers, message: "不允许输入特殊字符", trigger: "blur" },
  42. ],
  43. },
  44. };
  45. },
  46. methods: {
  47. submitForm(formName) {
  48. this.$refs[formName].validate((valid) => {
  49. if (valid) {
  50. console.log("submitForm");
  51. // alert("submit!");
  52. } else {
  53. console.log("error submit!!");
  54. return false;
  55. }
  56. });
  57. },
  58. },
  59. };
  60. </script>
  61. <style scoped lang="scss"></style>

Vue-穿梭框组件

image.png

附件:代码

  1. <template>
  2. <div class="usereq">
  3. <el-row :gutter="10">
  4. <el-col :span="14"><div class="grid-content">全部设备</div></el-col>
  5. <el-col :span="2"><div class="grid-content"></div></el-col>
  6. <el-col :span="8"><div class="grid-content">已选设备</div></el-col>
  7. </el-row>
  8. <el-row :gutter="10">
  9. <el-col :span="14">
  10. <div class="left_content">
  11. <el-row :gutter="10">
  12. <el-col :span="7">
  13. <el-select v-model="condition_equipment" multiple placeholder="全部设备">
  14. <el-option
  15. v-for="item in condition_equipmentArr"
  16. :key="item.value"
  17. :label="item.label"
  18. :value="item.value"
  19. ></el-option>
  20. </el-select>
  21. </el-col>
  22. <el-col :span="7">
  23. <el-select v-model="condition_area" multiple placeholder="全部区域">
  24. <el-option
  25. v-for="item in condition_areaArr"
  26. :key="item.value"
  27. :label="item.label"
  28. :value="item.value"
  29. ></el-option>
  30. </el-select>
  31. </el-col>
  32. <el-col :span="10">
  33. <el-input style="border-radius:5px;" v-model="equipment[2]" placeholder="搜索" prefix-icon="el-icon-search"></el-input>
  34. </el-col>
  35. </el-row>
  36. <el-row :gutter="10" style="padding:20px 0;margin-bottom:0;border-top:1px solid #323541;border-bottom:1px solid #323541;">
  37. <el-col class="center" :span="3"><el-checkbox class="grid-content able_checkbox" :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange">全选</el-checkbox></el-col>
  38. <el-col :span="1"><div class="grid-content"></div></el-col>
  39. <el-col :span="7"><div class="grid-content">设备编号</div></el-col>
  40. <el-col :span="6"><div class="grid-content">设备类型</div></el-col>
  41. <el-col :span="2"><div class="grid-content">区域</div></el-col>
  42. <el-col :span="5"><div class="grid-content"></div></el-col>
  43. </el-row>
  44. <el-checkbox-group v-model="checkedleft" @change="handleCheckedLeftChange">
  45. <el-row v-for="(equipmentInfos, index) in equipmentInfo" :key="index" :gutter="10" style="margin:0;padding:10px 0;border-bottom:1px solid #323541;">
  46. <div v-if="equipmentInfos.warn">
  47. <el-col class="center" :span="3">
  48. <el-checkbox class="prohibit_checkbox" disabled :label="equipmentInfos" :key="equipmentInfos.number"></el-checkbox>
  49. </el-col>
  50. <el-col :span="1"><div class="grid-content grid-Prohibit">{{index+1}}</div></el-col>
  51. <el-col :span="7"><div class="grid-content grid-Prohibit">{{equipmentInfos.number}}</div></el-col>
  52. <el-col :span="6"><div class="grid-content grid-Prohibit">{{equipmentInfos.type}}</div></el-col>
  53. <el-col :span="2"><div class="grid-content grid-Prohibit">{{equipmentInfos.area}}</div></el-col>
  54. <el-col :span="5"><div class="grid-content grid-Prohibit">{{equipmentInfos.warn}}</div></el-col>
  55. </div>
  56. <div v-else>
  57. <el-col class="center" :span="3">
  58. <el-checkbox class="able_checkbox" :label="equipmentInfos" :key="equipmentInfos.number"></el-checkbox>
  59. </el-col>
  60. <el-col :span="1"><div class="grid-content">{{index+1}}</div></el-col>
  61. <el-col :span="7"><div class="grid-content">{{equipmentInfos.number}}</div></el-col>
  62. <el-col :span="6"><div class="grid-content">{{equipmentInfos.type}}</div></el-col>
  63. <el-col :span="2"><div class="grid-content">{{equipmentInfos.area}}</div></el-col>
  64. </div>
  65. </el-row>
  66. </el-checkbox-group>
  67. </div>
  68. </el-col>
  69. <el-col :span="2">
  70. <div class="center_content">
  71. <div class="center_content_r">
  72. <div class="rule_btn rule_btn_left" icon="el-icon-plus" type="warning" @click="PutDataToRight()">
  73. <img src="./img/left.png">
  74. </div>
  75. <div style="margin-top:20px" class="rule_btn rule_btn_right" icon="el-icon-plus" type="warning" @click="PutDataToLeft()">
  76. <img src="./img/left.png">
  77. </div>
  78. </div>
  79. </div>
  80. </el-col>
  81. <el-col :span="8">
  82. <div class="left_content">
  83. <el-row :gutter="10" style="padding:20px 0;margin-bottom:0;border-bottom:1px solid #323541;">
  84. <el-col class="center" :span="6"><el-checkbox class="grid-content able_checkbox" :indeterminate="risIndeterminate" v-model="rcheckAll" @change="rhandleCheckAllChange">全选</el-checkbox></el-col>
  85. <el-col :span="4"><div class="grid-content"></div></el-col>
  86. <el-col :span="14"><div class="grid-content">设备编号</div></el-col>
  87. </el-row>
  88. <el-checkbox-group v-model="rcheckedleft" @change="rhandleCheckedLeftChange">
  89. <el-row v-for="(requipmentInfos, index) in requipmentInfo" :key="index" :gutter="10" style="margin:0;padding:10px 0;border-bottom:1px solid #323541;">
  90. <el-col class="center" :span="6">
  91. <el-checkbox class="able_checkbox" :label="requipmentInfos" :key="requipmentInfos.number"></el-checkbox>
  92. </el-col>
  93. <el-col :span="4"><div class="grid-content">{{index+1}}</div></el-col>
  94. <el-col :span="14"><div class="grid-content">{{requipmentInfos.number}}</div></el-col>
  95. </el-row>
  96. </el-checkbox-group>
  97. </div>
  98. </el-col>
  99. </el-row>
  100. </div>
  101. </template>
  102. <script>
  103. export default {
  104. data() {
  105. return {
  106. equipment: ['', '', ''], // 查询条件
  107. checkAll: false,
  108. isIndeterminate: true,
  109. checkedleft: [],
  110. rcheckAll: false,
  111. risIndeterminate: true,
  112. rcheckedleft: [],
  113. condition_equipment: '',
  114. condition_area: '',
  115. condition_equipmentArr: [], // 查询条件code
  116. condition_areaArr: [],
  117. equipmentInfo: [
  118. {
  119. number: 'AHU-L28-01',
  120. type: 'AHU',
  121. area: 'L55'
  122. },
  123. {
  124. number: 'AHU-L28-02',
  125. type: 'AHU',
  126. area: 'L55',
  127. warn: '数据不足'
  128. },
  129. {
  130. number: 'AHU-L28-03',
  131. type: 'AHU',
  132. area: 'L55'
  133. }
  134. ],
  135. requipmentInfo: [
  136. {
  137. number: 'AHU-L28-05',
  138. type: 'AHU',
  139. area: 'L55'
  140. }
  141. ]
  142. }
  143. },
  144. methods: {
  145. handleCheckAllChange(val) {
  146. this.checkedleft = val ? this.equipmentInfo : []
  147. this.isIndeterminate = false
  148. },
  149. handleCheckedLeftChange(v) {
  150. const checkedCount = v.length
  151. this.checkAll = checkedCount === this.equipmentInfo.length
  152. this.isIndeterminate = checkedCount > 0 && checkedCount < this.equipmentInfo.length
  153. },
  154. rhandleCheckAllChange(val) {
  155. this.rcheckedleft = val ? this.requipmentInfo : []
  156. this.risIndeterminate = false
  157. },
  158. rhandleCheckedLeftChange(v) {
  159. const checkedCount = v.length
  160. this.rcheckAll = checkedCount === this.requipmentInfo.length
  161. this.risIndeterminate = checkedCount > 0 && checkedCount < this.requipmentInfo.length
  162. },
  163. PutDataToRight() {
  164. console.log(JSON.parse(JSON.stringify(this.checkedleft)))
  165. this.requipmentInfo = this.handleConcatArr(this.requipmentInfo, this.checkedleft)
  166. this.handleRemoveTabList(this.checkedleft, this.equipmentInfo)
  167. console.log(this.equipmentInfo)
  168. this.checkedleft = []
  169. },
  170. PutDataToLeft() {
  171. this.equipmentInfo = this.handleConcatArr(this.equipmentInfo, this.rcheckedleft)
  172. this.handleRemoveTabList(this.rcheckedleft, this.requipmentInfo)
  173. this.rcheckedleft = []
  174. },
  175. handleConcatArr(selectArr, nowSelectData) {
  176. let arr = []
  177. arr = arr.concat(selectArr, nowSelectData)
  178. return arr
  179. },
  180. handleRemoveTabList(checkArr, originalArr) {
  181. for (const item of checkArr) {
  182. if (originalArr.indexOf(item) > -1) {
  183. this.$nextTick(() => {
  184. originalArr.splice(originalArr.indexOf(item), 1)
  185. })
  186. }
  187. }
  188. }
  189. }
  190. }
  191. </script>
  192. <style lang="scss" scoped>
  193. .usereq{
  194. .el-row{
  195. margin: 20px 0 !important;
  196. }
  197. .grid-content,.grid-Prohibit {
  198. text-align: center;
  199. color: #fff;
  200. font-size: 16px;
  201. border-radius: 4px;
  202. min-height: 36px;
  203. }
  204. .grid-Prohibit {
  205. color: #414346;
  206. }
  207. .grid-content /deep/.el-checkbox__label{
  208. font-size:16px;
  209. }
  210. .left_content{
  211. height:500px;
  212. padding:0 20px 20px 20px;
  213. overflow-y: auto;
  214. background: #020913;
  215. border-radius:5px;
  216. }
  217. .center_content{
  218. height:500px;
  219. display: flex;
  220. justify-content: center;
  221. align-items: center;
  222. border-radius:5px;
  223. }
  224. .el-select,/deep/ .el-input--small .el-input__inner{
  225. color:#616B80;
  226. width:100%;
  227. background: #152841;
  228. border-color:#152841;
  229. border-radius: 5px;
  230. }
  231. /deep/ .el-checkbox-group .el-checkbox__label{
  232. display: none;
  233. }
  234. .able_checkbox /deep/ .el-checkbox__inner {
  235. border-color: #868692;
  236. background: #020913;
  237. }
  238. .prohibit_checkbox /deep/.el-checkbox__inner{
  239. border-color: #414346;
  240. background: #020913;
  241. }
  242. .center{
  243. text-align: center;
  244. }
  245. .center_content_r{
  246. width:75%;
  247. height:180px;
  248. }
  249. .rule_btn{
  250. width:100%;
  251. height:60px;
  252. background:#152841;
  253. float:left;
  254. border:none;
  255. }
  256. .rule_btn_left, .rule_btn_right{
  257. background: #152841;
  258. display: flex;
  259. align-items: center;
  260. justify-content: center;
  261. cursor: pointer;
  262. border-radius:3px;
  263. }
  264. .rule_btn_left img{
  265. transform:rotate(180deg);
  266. }
  267. .rule_btn_left:hover, .rule_btn_right:hover{
  268. background:#1E3A5F
  269. }
  270. }
  271. </style>