whj 5 maanden geleden
bovenliggende
commit
4254cd17ca

+ 119 - 61
src/views/test/Test1.vue

@@ -1,25 +1,34 @@
 <template>
-  <a-row :gutter="10">
-    <a-col :span="5">
-    </a-col>
-    <a-col :span="19">
-      <div ref="container" class="box">
-        <div class="node" ref="node1">node1</div>
-        <div class="node" ref="node2">node2</div>
-        <div class="node" ref="node3">node3</div>
-      </div>
-    </a-col>
-  </a-row>
+
+  <div ref="container" class="container">
+    <Node v-for="(item, index) in details" :key="index" :detail="item" ref="node" />
+  </div>
 </template>
 
 <script>
 // import jsPlumb from 'jsplumb'
-import { ready, newInstance } from '@jsplumb/browser-ui'
+import Vue from 'vue'
+import Node from './modules/Node.vue'
+import { ready, newInstance, EVENT_CONNECTION, EVENT_CONNECTION_DBL_CLICK } from '@jsplumb/browser-ui'
 export default {
+  components: {
+    Node,
+  },
   data() {
     return {
       jsPlumb: null,
       instance: null,
+      details: [
+        {
+          name: 'node1',
+        },
+        {
+          name: 'node2',
+        },
+        {
+          name: 'node3',
+        },
+      ],
     }
   },
   mounted() {
@@ -29,60 +38,100 @@ export default {
   methods: {
     init() {
       let { instance } = this
-      // 初始化连接线
-      ready(() => {
-        // 设置连接线样式
-        return {
-          Connector: ['Bezier', { curviness: 100 }],
-          PaintStyle: { stroke: '#56777', strokeWidth: 2 },
-          HoverPaintStyle: { stroke: '#56777', strokeWidth: 4 },
-          EndpointStyle: { radius: 9, fill: '#56777' },
-          EndpointHoverStyle: { fill: '#222' },
-        }
-      })
       // 初始化节点
       instance = newInstance({
         container: this.$refs.container,
         dragOptions: {
           containment: 'parent',
           containmentPadding: 10,
-          grid: { w: 10, h: 10 },
+          grid: { w: 20, h: 20 },
         },
       })
-      const ep1 = instance.addEndpoint(this.$refs.node1, { target: true, source: true, endpoint: 'Dot' })
-      const ep2 = instance.addEndpoint(this.$refs.node2, { target: true, source: true, endpoint: 'Dot' })
-      const ep3 = instance.addEndpoint(this.$refs.node3, { target: true, source: true, endpoint: 'Dot' })
+      console.log()
       instance.importDefaults({
-        anchor: 'AutoDefault',
+        anchor: 'Continuous',
+        connectionsDetachable: false,
         // 连接器类型,这里设置为Flowchart
-        connector: 'Flowchart',
+        connector: {
+          type: 'Flowchart',
+        },
+        paintStyle: { stroke: '#456', strokeWidth: 3 },
+        hoverPaintStyle: { stroke: 'red', strokeWidth: 4 },
+        connectionOverlays: [
+          {
+            type: 'Arrow',
+            options: {
+              location: 1,
+            },
+          },
+          {
+            type: 'Custom',
+            options: {
+              create: (component) => {
+                const d = document.createElement('button')
+                d.innerHTML = '+'
+                //添加样式
+
+                d.className = 'plus_btn'
+                console.log(d)
+                return d
+              },
+              location: [5, 0],
+              events: {
+                tap: (e, o) => {
+                  console.log('tap', e, o)
+                },
+              },
+            },
+          },
+        ],
         // 添加两个标签和箭头
-        overlays: [{ type: 'Arrow', options: { location: 1 } }],
       })
+      instance.addSourceSelector('.bottom')
+      instance.addTargetSelector('.top')
+      console.log(this.$refs)
+      this.$refs.node.forEach((item) => {
+        instance.addEndpoint(item.$el, { target: true, source: true })
+      })
+
       // 连接三个端点
-      instance.connect({
-        // 获取节点1和节点2的引用
-        source: this.$refs.node1,
-        target: this.$refs.node2,
-        // 连接方式,这里设置为连续
-        anchor: 'AutoDefault',
-        // 连接器类型,这里设置为Flowchart
-        connector: 'Flowchart',
-        // 添加两个标签和箭头
-        overlays: [
-          { type: 'Label', options: { label: 'Connection 1', location: 0.5 } },
-          { type: 'Arrow', options: { location: 1 } },
-        ],
+      // instance.connect({
+      //   // 获取节点1和节点2的引用
+      //   source: this.$refs.node1,
+      //   target: this.$refs.node2,
+      //   // 连接方式,这里设置为连续
+      //   anchor: 'AutoDefault',
+      //   // 连接器类型,这里设置为Flowchart
+      //   connector: 'Flowchart',
+      //   // 添加两个标签和箭头
+      //   overlays: [
+      //     { type: 'Label', options: { label: 'Connection 1', location: 0.5 } },
+      //     { type: 'Arrow', options: { location: 1 } },
+      //   ],
+      // })
+      // instance.connect({
+      //   source: this.$refs.node2,
+      //   target: this.$refs.node3,
+      //   connector: 'Flowchart',
+      //   anchor: 'AutoDefault',
+      //   overlays: [
+      //     { type: 'Label', options: { label: 'Connection 2', location: 0.5 } },
+      //     { type: 'Arrow', options: { location: 1 } },
+      //   ],
+      // })
+      // 建立链接
+      instance.bind(EVENT_CONNECTION, (val) => {
+        console.log(val)
+        console.log(2)
       })
-      instance.connect({
-        source: this.$refs.node2,
-        target: this.$refs.node3,
-        connector: 'Flowchart',
-        anchor: 'AutoDefault',
-        overlays: [
-          { type: 'Label', options: { label: 'Connection 2', location: 0.5 } },
-          { type: 'Arrow', options: { location: 1 } },
-        ],
+      instance.bind(EVENT_CONNECTION_DBL_CLICK, (conn) => {
+        // 删除连接
+        this.$confirm({
+          title: '确定删除所点击的链接吗?',
+          onOk() {
+            instance.deleteConnection(conn)
+          },
+        })
       })
     },
   },
@@ -90,16 +139,25 @@ export default {
 </script>
 
 <style lang="less" scoped>
-.box {
+.container {
   position: relative;
-  background: #fff;
   width: 100%;
-  height: 500px;
-  .node {
-    width: 50px;
-    height: 50px;
-    position: absolute;
-    background: #ccc;
-  }
+  min-height: calc(100vh - 100px);
+  // transform: scale(0.5);
+}
+/deep/ .plus_btn {
+  padding: 0;
+  margin: 0;
+  background: #1890ff !important;
+  color: #fff !important;
+  border-radius: 50%;
+  width: 40px;
+  height: 40px;
+  border: #1890ff 1px solid;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  font-size: 24px;
+  cursor: pointer;
 }
 </style>

+ 0 - 70
src/views/test/modules/BindTable.vue

@@ -1,70 +0,0 @@
-<template>
-  <a-modal
-    title="数据绑定"
-    :visible="visible"
-    @cancel="handleCancel"
-    :width="800"
-    @ok="handleOk">
-    <a-table :columns="columns" :data-source="data">
-      <span slot="bind" slot-scope="text,record">
-        <a-select allowClear style="width:150px" v-model="record.bind" :options="selectList">
-        </a-select>
-      </span>
-    </a-table>
-  </a-modal>
-</template>
-
-<script>
-export default {
-  data () {
-    return {
-      visible: false,
-      confirmLoading: false,
-      selectList: [],
-      columns: [
-        {
-          title: '字段名',
-          dataIndex: 'columnComment',
-          key: 'columnComment'
-        },
-        {
-          title: '字段值',
-          dataIndex: 'columnName',
-          key: 'columnName'
-        },
-        {
-          title: '绑定值',
-          dataIndex: 'bind',
-          key: 'bind',
-          scopedSlots: { customRender: 'bind' }
-        }
-      ],
-      data: []
-    }
-  },
-  inject: ['getFormList'],
-  created () {
-
-  },
-  methods: {
-    base (record) {
-      this.visible = true
-      this.data = record
-      const arr = this.getFormList()
-      this.selectList = arr.filter(item => item.type !== 'divider')
-    },
-    handleOk () {
-      const bindList = this.data.filter(item => item.bind)
-      this.$emit('bind', bindList)
-      this.visible = false
-    },
-    handleCancel () {
-      this.visible = false
-    }
-  }
-}
-</script>
-
-<style>
-
-</style>

+ 0 - 70
src/views/test/modules/Component.vue

@@ -1,70 +0,0 @@
-<template>
-  <a-col @click="handleSelect" :span="detail.type==='divider'?24:24/config.layout">
-    <a-form-item :label="detail.label" v-if="detail.type!=='divider'">
-      <!-- 输入框 -->
-      <a-input v-if="detail.type==='input'" v-bind="detail.attrs" v-decorator="[detail.value, { rules: [{ required: detail.required, message: detail.attrs.placeholder}] }]" />
-      <!-- 数字输入框 -->
-      <a-input-number style="width:100%" v-if="detail.type==='number'" v-bind="detail.attrs" v-decorator="[detail.value, { rules: [{ required: detail.required, message: detail.attrs.placeholder}] }]" />
-      <!-- 文本域 -->
-      <a-textarea v-if="detail.type==='textarea'" v-bind="detail.attrs" v-decorator="[detail.value, { rules: [{ required: detail.required, message: detail.attrs.placeholder}] }]" />
-      <!-- 下拉框 -->
-      <a-select v-if="detail.type==='select'" v-bind="detail.attrs" v-decorator="[detail.value, { rules: [{ required: detail.required, message: detail.attrs.placeholder}] }]" >
-        <!-- <a-select-option v-for="item in detail.options" :value="item.value" :key="item.value">
-          {{ item.label }}
-        </a-select-option> -->
-      </a-select>
-      <!-- 日期时间 -->
-      <a-date-picker style="width:100%" v-if="detail.type==='date'" v-bind="detail.attrs" v-decorator="[detail.value, { rules: [{ required: detail.required, message: detail.attrs.placeholder}] }]" />
-      <!-- 文件上传 -->
-      <UploadFile v-if="detail.type==='uploadFile'" v-bind="detail.attrs" v-decorator="[detail.value, { rules: [{ required: detail.required, message: detail.attrs.placeholder}] }]" />
-      <!-- 图片上传 -->
-      <UploadImg v-if="detail.type==='uploadImg'" v-bind="detail.attrs" v-decorator="[detail.value, { rules: [{ required: detail.required, message: detail.attrs.placeholder}] }]" />
-      <!-- 选择数据 -->
-      <template v-if="detail.type==='dataSelect'">
-        <a-input style="width:70%" v-bind="detail.attrs" v-decorator="[detail.value, { rules: [{ required: detail.required, message: detail.attrs.placeholder}] }]" />
-        <a-button style="width:30%" type="primary" @click="handleSelectData">选择</a-button>
-      </template>
-    </a-form-item>
-    <!-- 分割线 -->
-    <a-divider v-bind="detail.attrs" v-if="detail.type==='divider'">
-      <template v-if="detail.label">
-        {{ detail.label }}
-      </template>
-    </a-divider>
-  </a-col>
-</template>
-
-<script>
-import UploadFile from '@/components/Upload/CUploadFile.vue'
-import UploadImg from '@/components/Upload/CUploadImg.vue'
-export default {
-  name: 'MComponent',
-  components: {
-    UploadFile,
-    UploadImg
-  },
-  props: {
-    detail: {
-      type: Object,
-      required: true,
-      default: () => {}
-    },
-    config: {
-      type: Object,
-      required: true
-    }
-  },
-  methods: {
-    handleSelect () {
-      this.$emit('select', this.detail)
-    },
-    handleSelectData () {
-      this.$emit('selectInfo', this.detail)
-    }
-  }
-}
-</script>
-
-<style>
-
-</style>

+ 0 - 258
src/views/test/modules/Detail.vue

@@ -1,258 +0,0 @@
-<template>
-  <a-card
-    :tab-list="tabList"
-    size="small"
-    style="min-height:600px"
-    :active-tab-key="selectKey"
-    @tabChange="onTabChange">
-    <a-form
-      v-show="model.id"
-      size="small"
-      v-if="selectKey === '0'">
-      <a-form-item label="标题">
-        <a-input v-model="model.label" />
-      </a-form-item>
-      <template v-if="model.type!=='divider'">
-        <a-form-item label="字段名称">
-          <a-input v-model="model.value" />
-        </a-form-item>
-        <a-form-item label="是否必填">
-          <a-switch v-model="model.required" />
-        </a-form-item>
-        <a-form-item label="默认提示" v-if="model.attrs">
-          <a-input v-model="model.attrs.placeholder" />
-        </a-form-item>
-      </template>
-      <template v-else>
-        <a-form-item label="布局">
-          <a-radio-group name="radioGroup" v-model="model.attrs.orientation">
-            <a-radio value="left">
-              左边
-            </a-radio>
-            <a-radio value="center">
-              中间
-            </a-radio>
-            <a-radio value="right">
-              右边
-            </a-radio>
-          </a-radio-group>
-        </a-form-item>
-      </template>
-      <!-- 数字输入框 -->
-      <template v-if="model.type === 'number'">
-        <a-form-item label="最小值">
-          <a-input-number v-model="model.min" />
-        </a-form-item>
-        <a-form-item label="最大值">
-          <a-input-number v-model="model.max" />
-        </a-form-item>
-        <a-form-item label="数值精度">
-          <a-input-number v-model="model.precision" />
-        </a-form-item>
-      </template>
-      <!-- 下拉框 -->
-      <template v-if="model.type === 'select'">
-        <a-form-item label="选项">
-          <VueDraggable
-            v-model="model.attrs.options"
-            :animation="150"
-            handle=".handle"
-          >
-            <div
-              v-for="(item, index) in model.attrs.options"
-              :key="index"
-              class="options"
-            >
-              <a-space>
-                <a-icon class="handle cursor-move" type="unordered-list" />
-                <a-input-group compact>
-                  <a-input style="width:50%" v-model="item.label" />
-                  <a-input style="width:50%" v-model="item.value" />
-                </a-input-group>
-                <a-icon type="close" @click="deleteOption(index)" />
-              </a-space>
-            </div>
-          </VueDraggable>
-          <a-button @click="addOption" style="width:100%"><a-icon type="plus" /></a-button>
-        </a-form-item>
-      </template>
-      <!-- 日期选择 -->
-      <template v-if="model.type === 'date'">
-        <a-form-item label="是否显示时间">
-          <a-switch v-model="model.attrs.showTime" />
-        </a-form-item>
-        <a-form-item label="时间格式">
-          <a-input placeholder="YYYY-MM-DD HH:mm:ss" v-model="model.attrs.format" ></a-input>
-        </a-form-item>
-      </template>
-      <!-- 上传 -->
-      <template v-if="model.type === 'uploadFile'||model.type === 'uploadImg'">
-        <a-form-item label="最大上传数">
-          <a-input-number v-model="model.attrs.maxSize" />
-        </a-form-item>
-      </template>
-      <!-- 选择数据 -->
-      <template v-if="model.type === 'dataSelect'">
-        <a-form-item label="选择表单">
-          <a-select v-model="model.attrs.dict" placeholder="请选择" :options="DictCache.getChildrenList('TABLE_MAPPING')" @change="dictChange">
-          </a-select>
-        </a-form-item>
-        <a-form-item label="选择类型">
-          <a-radio-group name="radioGroup" v-model="model.attrs.selectType" @change="selectTypeChange">
-            <a-radio value="radio">
-              单选
-            </a-radio>
-            <a-radio value="checkbox">
-              多选
-            </a-radio>
-          </a-radio-group>
-        </a-form-item>
-        <a-form-item label="默认字段" v-if="model.attrs.connect.length">
-          <a-select v-model="model.attrs.connect[0].columnName" placeholder="请选择">
-            <a-select-option v-for="item in tableList" :value="item.columnName" :key="item.columnName">
-              {{ item.columnComment }}
-            </a-select-option>
-          </a-select>
-        </a-form-item>
-        <!-- <a-form-item label="附加字段" v-if="model.attrs.connect.length&&model.attrs.selectType=='radio'">
-          <a-select mode="multiple" v-model="additionalField" placeholder="请选择" @change="additionalFieldChange">
-            <a-select-option v-for="item in tableList" :value="item.columnName" :key="item.columnName" :label=" item.columnComment">
-              {{ item.columnComment }}
-            </a-select-option>
-          </a-select>
-          <a-button type="primary" @click="addForm()">添加到表单</a-button>
-        </a-form-item> -->
-      </template>
-      <a-popconfirm
-        title="确定删除该组件?"
-        ok-text="确定"
-        cancel-text="取消"
-        @confirm="deleteModel"
-      >
-        <a-button type="danger" style="width:100%">删除</a-button>
-      </a-popconfirm>
-    </a-form>
-    <a-form
-      size="small"
-      v-if="selectKey === '1'">
-      <a-form-item label="布局">
-        <a-radio-group name="radioGroup" v-model="config.layout">
-          <a-radio :value="1">
-            单列
-          </a-radio>
-          <a-radio :value="2">
-            双列
-          </a-radio>
-          <a-radio :value="3">
-            三列
-          </a-radio>
-        </a-radio-group>
-      </a-form-item>
-    </a-form>
-    <BindTable ref="bindTable" @bind="handleBind" />
-  </a-card>
-</template>
-
-<script>
-
-import { VueDraggable } from 'vue-draggable-plus'
-import { getTableInfos } from '@/api/custom/form'
-import BindTable from './BindTable.vue'
-export default {
-  components: {
-    VueDraggable,
-    BindTable
-  },
-  data () {
-    return {
-      model: {
-        attrs: {
-          placeholder: ''
-        }
-      },
-      config: {},
-      selectKey: '0',
-      tabList: [
-        {
-          key: '0',
-          tab: '字段属性'
-        },
-        {
-          key: '1',
-          tab: '表单属性'
-        }
-      ],
-      tableList: [],
-      additionalField: []
-    }
-  },
-  created () {
-  },
-  methods: {
-    base (val, config) {
-      this.model = val
-      this.config = config
-      if (this.model.attrs.dict !== undefined && this.model.attrs.dict !== '') {
-        this.dictChange(this.model.attrs.dict)
-      }
-      this.additionalField = val.attrs.connect && val.attrs.connect.length > 1 ? val.attrs.connect.slice(1, val.attrs.connect.length).map(item => item.columnName) : []
-    },
-    addOption () {
-      this.model.attrs.options.push({
-        label: '选项' + (this.model.attrs.options.length + 1),
-        value: 'newValue' + (this.model.attrs.options.length + 1)
-      })
-    },
-    deleteOption (i) {
-      this.model.attrs.options.splice(i, 1)
-    },
-    deleteModel () {
-      this.$emit('delete', this.model)
-    },
-    dictChange (tableName) {
-      getTableInfos({ tableName }).then(res => {
-        this.tableList = res.data
-        if (this.model.attrs.connect.length === 0) {
-          this.model.attrs.connect.push({
-            bind: 'id',
-            columnName: 'id',
-            columnComment: 'id'
-          })
-        }
-      })
-    },
-    selectTypeChange () {
-      this.model.attrs.connect.splice(1)
-      this.additionalField = []
-    },
-    additionalFieldChange (val, e) {
-      const arr = e.map(item => {
-        return {
-          bind: item.key,
-          columnName: item.key,
-          columnComment: item.componentOptions.propsData.label
-        }
-      })
-      this.model.attrs.connect.splice(1, this.model.attrs.connect.length - 1, ...arr)
-    },
-    addForm () {
-      this.$emit('addForm', this.model.attrs.connect.slice(1, this.model.attrs.connect.length))
-    },
-    bindTable (tableName) {
-      this.$refs.bindTable.base(this.tableList)
-    },
-    handleBind (val) {
-      this.model.attrs.connect = val
-    },
-    onTabChange (key) {
-      this.selectKey = key
-    }
-  }
-}
-</script>
-
-<style lang="less" scoped>
-.options{
-  margin-bottom:5px ;
-}
-</style>

+ 52 - 0
src/views/test/modules/Node.vue

@@ -0,0 +1,52 @@
+<template>
+  <div class="node">
+    <div class="top"></div>
+    <div class="bottom"></div>
+    {{ detail.name }}
+  </div>
+</template>
+
+<script>
+export default {
+  props: {
+    detail: {
+      type: Object,
+      default: () => {},
+    },
+  },
+  data() {
+    return {}
+  },
+}
+</script>
+
+<style lang="less" scoped>
+.node {
+  width: 300px;
+  height: 200px;
+  position: absolute;
+  background: #fff;
+  .top {
+    position: absolute;
+    top: 0;
+    left: 50%;
+    transform: translate(-50%, -50%);
+    background: #456;
+    border-radius: 50%;
+    width: 10px;
+    height: 10px;
+    z-index: 9;
+  }
+  .bottom {
+    position: absolute;
+    bottom: 0;
+    background: #456;
+    border-radius: 50%;
+    left: 50%;
+    transform: translate(-50%, 50%);
+    width: 10px;
+    z-index: 9;
+    height: 10px;
+  }
+}
+</style>

+ 0 - 358
src/views/test/modules/SbInfoSelectModal.vue

@@ -1,358 +0,0 @@
-<template>
-  <a-modal
-    :title="modalTitle"
-    :width="1300"
-    :visible="visible"
-    :confirmLoading="confirmLoading"
-    class="ant-modal2"
-    @cancel="handleCancel"
-  >
-    <a-card :bordered="false">
-      <div class="table-page-search-wrapper">
-        <a-form layout="inline">
-          <a-row :gutter="48">
-            <a-col :md="8" :sm="24">
-              <a-form-item label="关键字">
-                <a-input v-model.trim="queryParam.keyword" placeholder="请输入名称/编码"/>
-              </a-form-item>
-            </a-col>
-            <!--            <a-col :md="8" :sm="24">
-              <a-form-item label="上层设备类型">
-                <a-tree-select
-                  style="width: 100%"
-                  :dropdownStyle="{ maxHeight: '400px', overflow: 'auto' }"
-                  :treeData="treeData"
-                  :treeNodeFilterProp="'title'"
-                  :showSearch="true"
-                  v-model="queryParam.parentId"
-                  placeholder="请选择"
-                >
-                </a-tree-select>
-              </a-form-item>
-            </a-col>-->
-            <a-col :md="6" :sm="24">
-              <a-form-item label="车间位置">
-                <a-select v-model="queryParam.positionId" placeholder="请选择">
-                  <a-select-option
-                    v-for="({id,name}) in sbPositionData"
-                    :key="id"
-                    :label="name"
-                    :value="id">{{ name }}
-                  </a-select-option>
-                </a-select>
-              </a-form-item>
-            </a-col>
-            <a-col :md="6" :sm="24">
-              <a-form-item label="设备类型">
-                <a-tree-select
-                  style="width: 100%"
-                  :dropdownStyle="{ maxHeight: '400px', overflow: 'auto' }"
-                  :treeData="treeData"
-                  :treeNodeFilterProp="'title'"
-                  :showSearch="true"
-                  placeholder="请选择"
-                  @change="handleChange"
-                >
-                </a-tree-select>
-              </a-form-item>
-            </a-col>
-            <a-col :md="8 || 24" :sm="24">
-              <span class="table-page-search-submitButtons">
-                <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
-                <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>
-              </span>
-            </a-col>
-          </a-row>
-        </a-form>
-      </div>
-
-      <div class="table-operator" style="margin-bottom: 8px;">
-      </div>
-
-      <s-table
-        ref="table"
-        size="default"
-        rowKey="id"
-        :columns="columns"
-        :data="loadData"
-        :alert="options.alert"
-        :customRow="options.customRow"
-        :rowSelection="options.rowSelection"
-        :scroll="{ x: 1300, y: BaseTool.Constant.scrollY }"
-        showPagination="auto"
-      >
-        <span slot="action" slot-scope="record">
-          <template>
-
-          </template>
-        </span>
-        <span slot="status" slot-scope="text">
-          <badge :status="DictCache.COLOR.SB_INFO_STATUS[text]" :text="statusMap[text]" />
-        </span>
-      </s-table>
-    </a-card>
-    <template slot="footer">
-      <a-button :loading="confirmLoading" type="primary" @click="handleCancel()">取消</a-button>
-      <a-button :loading="confirmLoading" type="primary" @click="handleSelect()">选择</a-button>
-    </template>
-  </a-modal>
-</template>
-
-<script>
-import { STable, Ellipsis } from '@/components'
-import { getSbInfoPage, fetchSbInfo, getSbInfoTree } from '@/api/sb/info'
-import { querySbPosition } from '@/api/sb/position'
-import { fetchSbTypeTree } from '@/api/sb/type'
-
-export default {
-  name: 'SbInfoSelectModal',
-  components: {
-    STable,
-    Ellipsis
-  },
-  props: {
-    type: {
-      type: String,
-      default: 'radio'
-    },
-    selectedRowKey: {
-      type: Array,
-      default: () => {
-        return []
-      }
-    },
-    selectedRow: {
-      type: Array,
-      default: () => {
-        return []
-      }
-    }
-  },
-  data () {
-    return {
-      confirmLoading: false,
-      mdl: {},
-      modalTitle: null,
-      visible: false,
-      // 查询参数
-      queryParam: {
-      },
-      extraQueryParam: {
-      },
-      depreciationTypeMap: {},
-      levelMap: {},
-      statusMap: {},
-      unitMap: {},
-      useTypeMap: {},
-      sourceTypeMap: {},
-      treeData: [],
-      sbPositionData: [],
-      typeList: [],
-      // 表头
-      columns: [
-        {
-          title: '设备名称',
-          checked: true,
-          dataIndex: 'name'
-        },
-        {
-          title: '设备编号',
-          dataIndex: 'no',
-          checked: true
-        },
-        {
-          title: '设备位号',
-          checked: true,
-          dataIndex: 'positionNo'
-        },
-        {
-          title: '型号',
-          checked: true,
-          dataIndex: 'model'
-        },
-        {
-          title: '设备类型',
-          dataIndex: 'type',
-          checked: true,
-          width: 200,
-          customRender: (text, record, index) => {
-            return record.typeName
-          }
-        },
-        {
-          title: '设备等级',
-          dataIndex: 'level',
-          checked: true,
-          width: 200,
-          customRender: (text, record, index) => {
-            return this.BaseTool.Object.getField(this.levelMap, text)
-          }
-        },
-        {
-          title: '状态',
-          dataIndex: 'status',
-          checked: true,
-          width: 200,
-          scopedSlots: { customRender: 'status' }
-        },
-        {
-          title: '备注',
-          dataIndex: 'remark',
-          width: 200
-        },
-        {
-          title: '操作',
-          key: 'action',
-          width: '200px',
-          align: 'center',
-          fixed: 'right',
-          scopedSlots: { width: 200, customRender: 'action' }
-        }
-      ],
-      // 加载数据方法 必须为 Promise 对象
-      loadData: parameter => {
-        parameter = {
-          ...parameter,
-          ...this.queryParam,
-          ...this.extraQueryParam,
-          typeList: this.typeList,
-          dataScope: {
-            sortBy: 'asc',
-            sortName: 'no'
-          }
-        }
-        return getSbInfoPage(Object.assign(parameter, this.queryParam))
-          .then(res => {
-            return res.data
-          })
-      },
-      selectedRowKeys: [],
-      selectedRows: [],
-
-      options: {
-        alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
-        rowSelection: {
-          selectedRowKeys: this.selectedRowKeys,
-          onChange: this.onSelectChange
-        }
-      },
-      optionAlertShow: true,
-      isCreated: false
-    }
-  },
-  created () {
-    this.tableOption()
-    this.depreciationTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_DEPRECIATIONTYPE)
-    this.levelMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_LEVEL)
-    this.statusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_INFO_STATUS)
-    this.unitMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBINFO_UNIT)
-    this.sourceTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SBTYPE_SOURCETYPE)
-    this.useTypeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SB_UES_TYPE)
-    querySbPosition().then(res => {
-      this.sbPositionData = res.data
-    })
-    fetchSbTypeTree().then(res => {
-      this.treeData = res.data
-    })
-  },
-  methods: {
-    tableOption () {
-      // this.setTree()
-      if (!this.optionAlertShow) {
-        this.options = {
-          alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
-          rowSelection: {
-            selectedRowKeys: this.selectedRowKeys,
-            onChange: this.onSelectChange,
-            type: this.type,
-            getCheckboxProps: record => ({
-              props: {
-                disabled: false,
-                name: record.id
-              }
-            })
-          },
-          customRow: (record) => {
-            return {
-              on: { // 事件
-                click: (event) => { // 点击行
-                  // 选择对象
-                  this.mySelect([record.id], [record])
-                },
-                dblclick: (event) => {
-                  this.mySelect([record.id], [record])
-                  this.handleSelect()
-                }
-              }
-            }
-          }
-        }
-        this.optionAlertShow = true
-      } else {
-        this.options = {
-          alert: false,
-          rowSelection: null
-        }
-        this.optionAlertShow = false
-      }
-    },
-    handleOk () {
-      // this.setTree()
-      this.$refs.table.refresh()
-    },
-    onSelectChange (selectedRowKeys, selectedRows) {
-      this.selectedRowKeys = selectedRowKeys
-      this.selectedRows = selectedRows
-    },
-    resetSearchForm () {
-      this.queryParam = {
-      }
-      this.$refs.table.refresh(true)
-    },
-    /**
-     * 设置设备类型树
-     */
-    base (record, queryParam = {}) {
-      this.visible = true
-      this.modalTitle = '选择设备'
-      this.queryParam = queryParam
-      if (this.isCreated) {
-        console.log(this.$refs.table)
-        this.$refs.table.clearSelected()
-        this.options.rowSelection.type = this.type
-        this.handleOk()
-      } else {
-        this.tableOption()
-        this.isCreated = true
-      }
-      // this.mySelect(this.selectedRowKeys, this.selectedRows)
-    },
-    handleCancel () {
-      this.visible = false
-      this.confirmLoading = false
-    },
-    handleSelect () {
-      if (this.selectedRowKeys.length === 0) {
-        this.$message.warn('请至少选择一项信息')
-      } else {
-        this.confirmLoading = true
-        this.$emit('selected', this.selectedRowKeys, this.selectedRows)
-        this.confirmLoading = false
-        this.visible = false
-      }
-    },
-    mySelect (selectedRowKeys, selectedRows) {
-      this.$refs.table.updateSelect(selectedRowKeys, selectedRows)
-      this.$refs.table.rowSelection.onChange(selectedRowKeys, selectedRows)
-    },
-    handleChange (value, label, extra) {
-      const data = this.treeData.find(item => item.id === value)
-      if (data && data.children && data.children.length > 0) {
-        this.typeList = data.children.map(item => item.id)
-      } else {
-        this.typeList = [value]
-      }
-    }
-  }
-}
-</script>

+ 0 - 49
src/views/test/modules/SelectInfo.vue

@@ -1,49 +0,0 @@
-<template>
-  <div>
-    <StoreSelectModal :type="detail.attrs.selectType" v-if="active === 't_store'" ref="select" @selected="selected"/>
-    <SpareStoreSelectModal :type="detail.attrs.selectType" v-else-if="active === 't_spare_part_info'" ref="select" @selected="selected"/>
-    <SbInfoSelectModal :type="detail.attrs.selectType" v-else-if="active === 't_sb_info'" ref="select" @selected="selected" />
-  </div>
-</template>
-
-<script>
-import SbInfoSelectModal from './SbInfoSelectModal.vue'
-import SpareStoreSelectModal from './SpareStoreSelectModal.vue'
-import StoreSelectModal from './StoreSelectModal.vue'
-export default {
-  components: {
-    SbInfoSelectModal,
-    SpareStoreSelectModal,
-    StoreSelectModal
-  },
-  data () {
-    return {
-      active: '',
-      detail: {}
-    }
-  },
-  methods: {
-    base (item) {
-      if (!item.attrs.dict) {
-        this.$message.warning('请配置表单!')
-        return
-      }
-      this.active = item.attrs.dict
-      this.detail = item
-      this.$nextTick(() => {
-        this.$refs.select.base()
-      })
-    },
-    selected (keys, rows) {
-      this.$emit('selected', keys, rows, this.detail)
-    }
-  },
-  created () {
-
-  }
-}
-</script>
-
-<style>
-
-</style>

+ 0 - 351
src/views/test/modules/SpareStoreSelectModal.vue

@@ -1,351 +0,0 @@
-<template>
-  <a-modal
-    :title="modalTitle"
-    :width="1300"
-    :visible="visible"
-    :confirmLoading="confirmLoading"
-    class="ant-modal2"
-    @cancel="handleCancel"
-  >
-    <a-card :bordered="false">
-      <a-row :gutter="8">
-        <!--        <a-col :span="5">
-          <a-tree
-            @expand="onExpand"
-            :expandedKeys="expandedKeys"
-            :autoExpandParent="true"
-            @select="onSelect"
-            :selectedKeys="selectedKeys"
-            :treeData="spareTypeTreeData"
-          />
-        </a-col>-->
-        <a-col :span="24">
-          <div class="table-page-search-wrapper">
-            <a-form layout="inline">
-              <a-row :gutter="48">
-                <a-col :md="6" :sm="24">
-                  <a-form-item label="仓库编码">
-                    <a-input v-model.trim="queryParam.storeNo" placeholder="仓库编码"/>
-                  </a-form-item>
-                </a-col>
-                <a-col :md="6" :sm="24">
-                  <a-form-item label="仓库名称">
-                    <a-input v-model.trim="queryParam.storeName" placeholder="仓库名称"/>
-                  </a-form-item>
-                </a-col>
-                <a-col :md="6" :sm="24">
-                  <a-form-item label="存货编码">
-                    <a-input v-model.trim="queryParam.spareNo" placeholder="存货名称"/>
-                  </a-form-item>
-                </a-col>
-                <a-col :md="6" :sm="24">
-                  <a-form-item label="存货名称">
-                    <a-input v-model.trim="queryParam.spareName" placeholder="存货名称"/>
-                  </a-form-item>
-                </a-col>
-                <a-col :md="6" :sm="24">
-                  <a-form-item label="规格型号">
-                    <a-input v-model.trim="queryParam.ggxh" placeholder="规格型号"/>
-                  </a-form-item>
-                </a-col>
-                <a-col :md="6 || 24" :sm="24">
-                  <a-form-item label="厂区">
-                    <a-select v-model="queryParam.tokenType" placeholder="请选择">
-                      <a-select-option
-                        v-for="(label,value) in flagMap"
-                        :key="value"
-                        :label="label"
-                        :value="parseInt(value)">{{ label }}
-                      </a-select-option>
-                    </a-select>
-                  </a-form-item>
-                </a-col>
-                <a-col :md="8 || 24" :sm="24">
-                  <span class="table-page-search-submitButtons">
-                    <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
-                    <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>
-                  </span>
-                </a-col>
-              </a-row>
-            </a-form>
-          </div>
-
-          <div class="table-operator" style="margin-bottom: 8px;">
-          </div>
-
-          <s-table
-            ref="table"
-            size="default"
-            rowKey="autoId"
-            :columns="columns"
-            :data="loadData"
-            :alert="options.alert"
-            :customRow="options.customRow"
-            :rowSelection="options.rowSelection"
-            showPagination="auto"
-          >
-          </s-table>
-        </a-col>
-      </a-row>
-      <detail ref="detailModal"/>
-    </a-card>
-    <template slot="footer">
-      <a-button :loading="confirmLoading" type="primary" @click="handleCancel()">取消</a-button>
-      <a-button :loading="confirmLoading" type="primary" @click="handleSelect()">选择</a-button>
-    </template>
-  </a-modal>
-</template>
-
-<script>
-import { STable, Ellipsis } from '@/components'
-import { fetchSpareTypeTree } from '@/api/sqarepartmanage/sparetype'
-import { fetchStoreTree } from '@/api/store/store'
-
-import { getSpareStorePageYY } from '@/api/yongyou/yongyou'
-export default {
-  name: 'SpareStoreSelectModalYY',
-  components: {
-    STable,
-    Ellipsis
-  },
-  props: {
-    type: {
-      type: String,
-      default: 'radio'
-    },
-    selectedRowKey: {
-      type: Array,
-      default: () => {
-        return []
-      }
-    },
-    selectedRow: {
-      type: Array,
-      default: () => {
-        return []
-      }
-    }
-  },
-  data () {
-    return {
-      confirmLoading: false,
-      mdl: {},
-      storeTreeDate: [],
-      modalTitle: null,
-      visible: false,
-      record: null,
-      spareTypeTreeData: [],
-      expandedKeys: [],
-      selectedKeys: [],
-      isSpecial: null,
-      // 查询参数
-      queryParam: {
-        storeNo: '09',
-        tokenType: 1
-      },
-      // 表头
-      columns: [
-        {
-          title: '序号',
-          dataIndex: 'index',
-          customRender: (text, record, index) => {
-            return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
-          }
-        },
-        {
-          title: '存货编号',
-          dataIndex: 'no'
-        },
-        {
-          title: '存货名称',
-          dataIndex: 'spareName'
-        },
-        {
-          title: '规格型号',
-          dataIndex: 'ggxh'
-        },
-        {
-          title: '仓库名称',
-          dataIndex: 'storeName'
-        },
-        {
-          title: '货架号',
-          dataIndex: 'storePosition'
-        },
-        {
-          title: '批号',
-          dataIndex: 'cbatch'
-        },
-        {
-          title: '库存数量',
-          dataIndex: 'num'
-        },
-        {
-          title: '单位',
-          dataIndex: 'unit'
-        }
-      ],
-      // 下拉框map
-      delFlagMap: {},
-      flagMap: {},
-      // 加载数据方法 必须为 Promise 对象
-      loadData: parameter => {
-        parameter = {
-          ...parameter,
-          ...this.queryParam,
-          dataScope: {
-            sortBy: 'desc',
-            sortName: 'update_time'
-          }
-        }
-        return getSpareStorePageYY(Object.assign(parameter, this.queryParam)).then(res => {
-          if (res.data.rows === null) {
-            const data = { total: 0, rows: [], pageNum: 1, pageSize: 10, pages: 1 }
-            return data
-          } else {
-            return res.data
-          }
-        })
-      },
-      selectedRowKeys: [],
-      selectedRows: [],
-      options: {
-        alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
-        rowSelection: {
-          selectedRowKeys: this.selectedRowKeys,
-          onChange: this.onSelectChange
-        }
-      },
-      optionAlertShow: false,
-      isCreated: false
-    }
-  },
-  created () {
-    // 下拉框map
-    this.delFlagMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.DELFLAG)
-    this.flagMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.PROJECT_NEW_AND_OLD)
-
-    // this.tableOption()
-    fetchSpareTypeTree({}).then(res => {
-      this.spareTypeTreeData = res.data
-    })
-    fetchStoreTree({}).then(res => {
-      this.storeTreeDate = res.data
-    })
-  },
-  methods: {
-    tableOption () {
-      if (!this.optionAlertShow) {
-        this.options = {
-          alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
-          rowSelection: {
-            selectedRowKeys: this.selectedRowKeys,
-            onChange: this.onSelectChange,
-            type: this.type,
-            getCheckboxProps: record => ({
-              props: {
-                disabled: false,
-                name: record.id
-              }
-            })
-          }
-          // customRow: (record) => {
-          //   return {
-          //     on: { // 事件
-          //       click: (event) => { // 点击行
-          //         // 选择对象
-          //         this.mySelect([record.id], [record])
-          //       },
-          //       dblclick: (event) => {
-          //         this.mySelect([record.id], [record])
-          //         this.handleSelect()
-          //       }
-          //     }
-          //   }
-          // }
-        }
-        this.optionAlertShow = true
-      } else {
-        this.options = {
-          alert: false,
-          rowSelection: null
-        }
-        this.optionAlertShow = false
-      }
-    },
-    handleOk () {
-      this.$refs.table.refresh()
-    },
-    onSelectChange (selectedRowKeys, selectedRows) {
-      this.selectedRows = [...new Set([...this.selectedRows, ...selectedRows])]
-      this.selectedRowKeys = selectedRowKeys
-    },
-    resetSearchForm () {
-      this.queryParam = {
-        storeNo: '09'
-      }
-      this.$refs.table.refresh(true)
-    },
-    base (record, queryParam = { storeNo: '09' }) {
-      this.visible = true
-      this.modalTitle = '选择信息'
-      this.queryParam = queryParam
-      this.queryParam.tokenType = record && record.tokenType ? record.tokenType : 1
-      if (queryParam.isSpecial !== undefined) {
-        this.isSpecial = queryParam.isSpecial
-        this.record = record
-      }
-      if (this.isCreated) {
-        this.$refs.table.clearSelected()
-        // this.options.rowSelection.type = this.type
-        this.handleOk()
-      } else {
-        this.tableOption()
-        this.isCreated = true
-      }
-    },
-    handleCancel () {
-      this.visible = false
-      this.confirmLoading = false
-    },
-    handleSelect () {
-      if (this.selectedRowKeys.length === 0) {
-        this.$message.warn('请至少选择一项信息')
-      } else {
-        /* console.log(this.selectedRows[0].num)
-         if (this.selectedRows[0].num == 0) {
-         this.$message.error('不能选择库存为0的物品,请重新选择')
-         return
-       } */
-        this.confirmLoading = true
-        if (this.record !== null) {
-          this.record.isSpecial = this.isSpecial
-        }
-        this.selectedRows = this.selectedRows.filter(item => this.selectedRowKeys.includes(+item.id))
-        this.$emit('selected', this.selectedRowKeys, this.selectedRows)
-        this.confirmLoading = false
-        this.visible = false
-      }
-    },
-    // mySelect (selectedRowKeys, selectedRows) {
-    //   this.selectedRowKeys = selectedRowKeys
-    //   this.selectedRows = selectedRows
-    //   console.log(this.selectedRowKeys, this.selectedRows)
-    //   this.$refs.table.updateSelect(this.selectedRowKeys, this.selectedRows)
-    //   this.$refs.table.rowSelection.onChange(this.selectedRowKeys, this.selectedRows)
-    // },
-    onSelect: function (selectedKeys, info) {
-      this.selectedKeys = selectedKeys
-      this.queryParam.typeId = selectedKeys.length > 0 ? selectedKeys[0] : ''
-      this.$refs.table.refresh(true)
-    },
-    onExpand (expandedKeys) {
-      this.expandedKeys = expandedKeys
-      this.autoExpandParent = false
-    },
-    handleAdd () {
-      this.$refs.addSpareForm.base()
-    }
-  }
-}
-</script>

+ 0 - 281
src/views/test/modules/StoreSelectModal.vue

@@ -1,281 +0,0 @@
-<template>
-  <a-modal
-    :title="modalTitle"
-    :width="1000"
-    :visible="visible"
-    :confirmLoading="confirmLoading"
-    class="ant-modal2"
-    @cancel="handleCancel"
-  >
-    <a-card :bordered="false">
-      <div class="table-page-search-wrapper">
-        <a-form layout="inline">
-          <a-row :gutter="48">
-            <a-col :md="8" :sm="24">
-              <a-form-item label="关键字">
-                <a-input v-model.trim="queryParam.keyword" placeholder="请输入名称/编码"/>
-              </a-form-item>
-            </a-col>
-            <a-col :md="8 || 24" :sm="24">
-              <span class="table-page-search-submitButtons">
-                <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
-                <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>
-              </span>
-            </a-col>
-          </a-row>
-        </a-form>
-      </div>
-
-      <div class="table-operator" style="margin-bottom: 8px;">
-      </div>
-
-      <s-table
-        ref="table"
-        size="default"
-        rowKey="id"
-        :columns="columns"
-        :data="loadData"
-        :alert="options.alert"
-        :customRow="options.customRow"
-        :rowSelection="options.rowSelection"
-        showPagination="auto"
-      >
-        <span slot="delFlag" slot-scope="text">
-          <badge
-            :status="DictCache.COLOR.DELFLAG[text]"
-            :text="delFlagMap[text]" />
-        </span>
-      </s-table>
-    </a-card>
-    <template slot="footer">
-      <a-button :loading="confirmLoading" type="primary" @click="handleCancel()">取消</a-button>
-      <a-button :loading="confirmLoading" type="primary" @click="handleSelect()">选择</a-button>
-    </template>
-  </a-modal>
-</template>
-
-<script>
-import { STable, Ellipsis } from '@/components'
-import { getStorePage, fetchStore } from '@/api/store/store'
-
-export default {
-  name: 'StoreSelectModal',
-  components: {
-    STable,
-    Ellipsis
-  },
-  props: {
-    type: {
-      type: String,
-      default: 'radio'
-    },
-    selectedRowKey: {
-      type: Array,
-      default: () => {
-        return []
-      }
-    },
-    selectedRow: {
-      type: Array,
-      default: () => {
-        return []
-      }
-    }
-  },
-  data () {
-    return {
-      confirmLoading: false,
-      mdl: {},
-      modalTitle: null,
-      visible: false,
-      record: null,
-      // 查询参数
-      queryParam: {
-      },
-      extraQueryParam: {
-      },
-      // 表头
-      columns: [
-        {
-          title: '序号',
-          dataIndex: 'index',
-          customRender: (text, record, index) => {
-            return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
-          }
-        },
-        {
-          title: '编码',
-          dataIndex: 'no'
-        },
-        {
-          title: '名称',
-          dataIndex: 'name'
-        },
-        {
-          title: '等級',
-          dataIndex: 'level',
-          customRender: (text, record, index) => {
-            return this.BaseTool.Object.getField(this.levelMap, text)
-          }
-        },
-        {
-          title: '类型',
-          dataIndex: 'type',
-          customRender: (text, record, index) => {
-            return this.BaseTool.Object.getField(this.typeMap, text)
-          }
-        },
-        {
-          title: '上层仓库',
-          dataIndex: 'parentId',
-          customRender: (text, record, index) => {
-            return record.parentName
-          }
-        },
-        {
-          title: '备注',
-          dataIndex: 'remark'
-        },
-        {
-          title: '是否删除',
-          dataIndex: 'delFlag',
-          scopedSlots: { customRender: 'delFlag' }
-        },
-        {
-          title: '创建日期',
-          dataIndex: 'createdTime'
-        }
-      ],
-      // 下拉框map
-      typeMap: {},
-      levelMap: {},
-      delFlagMap: {},
-      // 加载数据方法 必须为 Promise 对象
-      loadData: parameter => {
-        parameter = {
-          ...parameter,
-          ...this.queryParam,
-          ...this.extraQueryParam,
-          dataScope: {
-          }
-        }
-        return getStorePage(Object.assign(parameter, this.queryParam))
-          .then(res => {
-            return res.data
-          })
-      },
-      selectedRowKeys: [],
-      selectedRows: [],
-
-      options: {
-        alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
-        rowSelection: {
-          selectedRowKeys: this.selectedRowKeys,
-          onChange: this.onSelectChange
-        }
-      },
-      optionAlertShow: false,
-      isCreated: false
-    }
-  },
-  created () {
-    // 下拉框map
-    this.levelMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.STORE_LEVEL)
-    this.typeMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.STORE_TYPE)
-    this.delFlagMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.DELFLAG)
-  },
-  methods: {
-    tableOption () {
-      if (!this.optionAlertShow) {
-        this.options = {
-          alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
-          rowSelection: {
-            selectedRowKeys: this.selectedRowKeys,
-            onChange: this.onSelectChange,
-            type: this.type,
-            getCheckboxProps: record => ({
-              props: {
-                disabled: false,
-                name: record.id
-              }
-            })
-          },
-          customRow: (record) => {
-            return {
-              on: { // 事件
-                click: (event) => { // 点击行
-                  // 选择对象
-                  this.mySelect([record.id], [record])
-                },
-                dblclick: (event) => {
-                  this.mySelect([record.id], [record])
-                  this.handleSelect()
-                }
-              }
-            }
-          }
-        }
-        this.optionAlertShow = true
-      } else {
-        this.options = {
-          alert: false,
-          rowSelection: null
-        }
-        this.optionAlertShow = false
-      }
-    },
-    handleView (record) {
-      fetchStore({ id: record.id }).then(res => {
-        const modal = this.$refs.detailModal
-        modal.base(res.data)
-      })
-    },
-    handleOk () {
-      this.$refs.table.refresh()
-    },
-    onSelectChange (selectedRowKeys, selectedRows) {
-      this.selectedRowKeys = selectedRowKeys
-      this.selectedRows = selectedRows
-    },
-    resetSearchForm () {
-      this.queryParam = {
-      }
-      this.$refs.table.refresh(true)
-    },
-    base (record, queryParam = {}, extraQueryParam = {}) {
-      this.visible = true
-      this.modalTitle = '选择信息'
-      this.queryParam = queryParam
-      this.extraQueryParam = extraQueryParam
-      this.record = record
-      if (this.isCreated) {
-        this.$refs.table.clearSelected()
-        console.log(this.options.rowSelection, 9999)
-        this.options.rowSelection.type = this.type
-        this.handleOk()
-      } else {
-        this.tableOption()
-        this.isCreated = true
-      }
-    },
-    handleCancel () {
-      this.visible = false
-      this.confirmLoading = false
-    },
-    handleSelect () {
-      if (this.selectedRowKeys.length === 0) {
-        this.$message.warn('请至少选择一项信息')
-      } else {
-        this.confirmLoading = true
-        this.$emit('selected', this.selectedRowKeys, this.selectedRows)
-        this.confirmLoading = false
-        this.visible = false
-      }
-    },
-    mySelect (selectedRowKeys, selectedRows) {
-      this.$refs.table.updateSelect(selectedRowKeys, selectedRows)
-      this.$refs.table.rowSelection.onChange(selectedRowKeys, selectedRows)
-    }
-  }
-}
-</script>

+ 4 - 113
src/views/test/modules/components.js

@@ -1,100 +1,6 @@
-export const componentBaseList = [
+export const componentList = [
   {
-    id: 1,
-    name: '单行文本',
-    type: 'input',
-    value: 'input',
-    dependentId: false,
-    required: true,
-    label: '单行文本',
-    attrs: {
-      placeholder: '请输入'
-    }
-  },
-  {
-    id: 2,
-    name: '多行文本',
-    type: 'textarea',
-    value: 'textarea',
-    dependentId: false,
-    required: true,
-    label: '多行文本',
-    attrs: {
-      placeholder: '请输入'
-    }
-  },
-  {
-    id: 3,
-    name: '数字',
-    type: 'number',
-    value: 'number',
-    dependentId: false,
-    required: true,
-    label: '数字',
-    attrs: {
-      placeholder: '请输入',
-      max: Infinity,
-      min: -Infinity,
-      precision: 2
-    }
-  },
-  {
-    id: 4,
-    name: '下拉框',
-    type: 'select',
-    value: 'select',
-    dependentId: false,
-    required: true,
-    label: '下拉框',
-    attrs: {
-      options: [
-        {
-          label: '选项1',
-          value: '1'
-        },
-        {
-          label: '选项2',
-          value: '2'
-        },
-        {
-          label: '选项3',
-          value: '3'
-        }
-      ],
-      placeholder: '请输入'
-    }
-  },
-  {
-    id: 5,
-    name: '日期时间',
-    type: 'date',
-    value: 'date',
-    dependentId: false,
-    required: true,
-    label: '日期时间',
-    attrs: {
-      placeholder: '请输入',
-      format: 'YYYY-MM-DD HH:mm:ss',
-      showTime: false
-    }
-  },
-  {
-    id: 8,
-    name: '分割线',
-    type: 'divider',
-    value: 'divider',
-    dependentId: false,
-    required: true,
-    label: '分割线',
-    attrs: {
-      orientation: 'center'
-    }
-  }
-]
-// 高级
-export const componenHidetList = [
-  {
-    id: 6,
+    id: 0,
     name: '文件上传',
     type: 'uploadFile',
     value: 'uploadFile',
@@ -119,20 +25,5 @@ export const componenHidetList = [
       maxSize: 5
     }
   },
-  {
-    id: 9,
-    name: '选择数据',
-    type: 'dataSelect',
-    value: 'id',
-    dependentId: false,
-    required: true,
-    label: '选择数据',
-    attrs: {
-      placeholder: '请选择',
-      disabled: true,
-      selectType: 'radio',
-      dict: '',
-      connect: []
-    }
-  }
-]
+ 
+]