cuijian
2025-06-28 7e0c515f1170d41a62dc73c1ea7c6cb4e40ce3c9
供应商管理、线边库管理、产线人员绑定
已重命名1个文件
已添加5个文件
已修改1个文件
2093 ■■■■ 文件已修改
src/views/base/FactoryManager.vue 159 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/base/SupplierList.vue 383 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/base/WarehouseList.vue 356 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/base/modules/FactoryManager/SelectUserModal.vue 287 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/base/modules/FactoryManager/UserFactory.vue 149 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/base/modules/supplier/SupplierModel.vue 521 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/base/modules/warehouse/WarehouseModel.vue 238 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/base/FactoryManager.vue
@@ -7,11 +7,11 @@
        <a-row style="margin-left: 14px">
          <a-button @click="handleAdd(1)" type="primary">添加车间</a-button>
          <a-button @click="handleAdd(2)" type="primary">添加下级</a-button>
          <a-button type="primary" icon="download" @click="handleExportXls('车间信息')">导出</a-button>
          <!-- <a-button type="primary" icon="download" @click="handleExportXls('车间信息')">导出</a-button>
          <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader"
                    :action="importExcelUrl" @change="handleImportExcel">
            <a-button type="primary" icon="import">导入</a-button>
          </a-upload>
          </a-upload> -->
          <a-button @click="handleDelete" v-if="selectedKeys.length>0">删除</a-button>
          <a-button title="删除多条数据" @click="batchDel" v-if="checkedKeys.length>0">批量删除</a-button>
          <!--<a-button @click="refresh" type="default" icon="reload" :loading="loading">刷新</a-button>-->
@@ -27,38 +27,11 @@
          <a-input-search @search="onSearch" style="width:100%;margin-top: 10px" placeholder="请输入车间名称"/>
          <!-- æ ‘-->
          <a-col :md="10" :sm="24">
            <!--<template>-->
            <!--<a-dropdown :trigger="[this.dropTrigger]" @visibleChange="dropStatus">-->
            <!--<span style="user-select: none">-->
            <!--<a-tree-->
            <!--checkable-->
            <!--multiple-->
            <!--@select="onSelect"-->
            <!--@check="onCheck"-->
            <!--@rightClick="rightHandle"-->
            <!--:selectedKeys="selectedKeys"-->
            <!--:checkedKeys="checkedKeys"-->
            <!--:treeData="factoryTree"-->
            <!--:checkStrictly="checkStrictly"-->
            <!--:expandedKeys="iExpandedKeys"-->
            <!--:autoExpandParent="autoExpandParent"-->
            <!--@expand="onExpand"/>-->
            <!--</span>-->
            <!--&lt;!&ndash;新增右键点击事件,和增加添加和删除功能&ndash;&gt;-->
            <!--<a-menu slot="overlay">-->
            <!--<a-menu-item @click="handleAdd(3)" key="1">添加</a-menu-item>-->
            <!--<a-menu-item @click="handleDelete" key="2">删除</a-menu-item>-->
            <!--<a-menu-item @click="closeDrop" key="3">取消</a-menu-item>-->
            <!--</a-menu>-->
            <!--</a-dropdown>-->
            <!--</template>-->
            <a-tree
              checkable
              multiple
              @select="onSelect"
              @check="onCheck"
              @rightClick="rightHandle"
              :selectedKeys="selectedKeys"
              :checkedKeys="checkedKeys"
              :treeData="factoryTree"
@@ -128,9 +101,17 @@
          </a-card>
        </a-tab-pane>
        <!-- <a-tab-pane tab="设备列表" key="2" forceRender>
          <factory-equipment ref="departAuth"></factory-equipment>
        </a-tab-pane> -->
        <a-tab-pane tab="人员列表" key="2" forceRender>
          <user-factory ref="userFactory"></user-factory>
          <!-- <a-card v-if="factoryCategory == '3'">
            <user-factory ref="userFactory"></user-factory>
          </a-card>
           <a-card v-else>
            <a-empty>
              <span slot="description"> è¯·å…ˆé€‰æ‹©ä¸€ä¸ªäº§çº¿! </span>
            </a-empty>
          </a-card> -->
        </a-tab-pane>
      </a-tabs>
    </a-col>
@@ -138,7 +119,7 @@
  </a-row>
</template>
<script>
  import FactoryEquipment from './modules/FactoryManager/FactoryEquipment'
  import UserFactory from './modules/FactoryManager/UserFactory'
  import { queryFactoryTreeList, searchByKeywords, deleteByFactory } from '@/api/api'
  import { httpAction, deleteAction } from '@/api/manage'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
@@ -148,7 +129,7 @@
    name: 'FactoryManager',
    mixins: [JeecgListMixin],
    components: {
      FactoryEquipment,
      UserFactory,
      FactoryModal
    },
    data() {
@@ -162,16 +143,10 @@
        treeData: [],
        visible: false,
        factoryTree: [],
        rightClickSelectedKey: '',
        rightClickSelectedOrgCode: '',
        hiding: true,
        model: {},
        dropTrigger: '',
        depart: {},
        disableSubmit: false,
        checkedKeys: [],
        selectedKeys: [],
        autoIncr: 1,
        currSelected: {},
        allTreeKeys: [],
        checkStrictly: true,
@@ -198,7 +173,8 @@
          importExcelUrl: '/base/factory/importExcel'
        },
        orgCategoryDisabled: false,
        isIncludesNotLeaf: false
        isIncludesNotLeaf: false,
        factoryCategory:''
      }
    },
    computed: {
@@ -216,7 +192,6 @@
        that.factoryTree = []
        queryFactoryTreeList().then((res) => {
          if (res.success) {
            //部门全选后,再添加部门,选中数量增多
            this.allTreeKeys = []
            for (let i = 0; i < res.result.length; i++) {
              let temp = res.result[i]
@@ -224,7 +199,6 @@
              that.factoryTree.push(temp)
              that.setThisExpandedKeys(temp)
              that.getAllKeys(temp)
              // console.log(temp.id)
            }
            this.loading = false
          }
@@ -242,40 +216,14 @@
        this.loading = true
        this.loadTree()
      },
      // å³é”®æ“ä½œæ–¹æ³•
      rightHandle({ event, node }) {
        this.dropTrigger = 'contextmenu'
        const record = node.dataRef
        this.rightClickSelectedKey = record.id
        this.rightClickSelected = record
        this.rightClickSelectedOrgCode = record.orgCode
      },
      onExpand(expandedKeys) {
        console.log('onExpand', expandedKeys)
        this.iExpandedKeys = expandedKeys
        this.autoExpandParent = false
      },
      backFlowList() {
        this.$router.back(-1)
      },
      // å³é”®ç‚¹å‡»ä¸‹æ‹‰æ¡†æ”¹å˜äº‹ä»¶
      dropStatus(visible) {
        if (visible == false) {
          this.dropTrigger = ''
        }
      },
      // å³é”®ä¸‹æ‹‰å…³é—­ä¸‹æ‹‰æ¡†
      closeDrop() {
        this.dropTrigger = ''
      },
      addRootNode() {
        this.$refs.nodeModal.add(this.currFlowId, '')
      },
      batchDel: function() {
        console.log(this.checkedKeys)
        this.isIncludesNotLeaf = false
        this.includesNotLeaf(this.factoryTree)
        console.log('isIncludesNotLeaf', this.isIncludesNotLeaf)
        // ä¸ºtrue则表示选中项包含非叶子结点 false则表示选中项均为叶子结点
        if (!this.isIncludesNotLeaf) {
@@ -355,17 +303,7 @@
        }
      },
      nodeModalOk() {
        this.loadTree()
      },
      nodeModalClose() {
      },
      hide() {
        console.log(111)
        this.visible = false
      },
      onCheck(checkedKeys, info) {
        console.log('onCheck', checkedKeys, info)
        this.hiding = false
        //---- author:os_chengtgen -- date:20190827 --  for:切换父子勾选模式 =======------
        if (this.checkStrictly) {
@@ -376,17 +314,20 @@
        //---- author:os_chengtgen -- date:20190827 --  for:切换父子勾选模式 =======------
      },
      onSelect(selectedKeys, e) {
        console.log('selected', selectedKeys, e)
        this.hiding = false
        this.deleteTrigger = 'leftClick'
        let record = e.node.dataRef
        console.log('onSelect-record', record)
        this.factoryCategory = record.factoryCategory
        this.currSelected = Object.assign({}, record)
        this.model = this.currSelected
        this.selectedKeys = [record.key]
        this.model.parentId = record.parentId
        this.setValuesToForm(record)
        this.$refs.departAuth.show(record.id)
        if(record.factoryCategory == '3'){
          this.$refs.userFactory.show(record.id)
        }else{
          this.$refs.userFactory.factoryId = ''
        }
      },
      // è§¦å‘onSelect事件时,为部门树右侧的form表单赋值
      setValuesToForm(record) {
@@ -404,16 +345,7 @@
        this.checkedKeys = []
        this.currSelected = {}
        this.selectedKeys = []
        this.$refs.departAuth.departId = ''
      },
      handleNodeTypeChange(val) {
        this.currSelected.nodeType = val
      },
      notifyTriggerTypeChange(value) {
        this.currSelected.notifyTriggerType = value
      },
      receiptTriggerTypeChange(value) {
        this.currSelected.receiptTriggerType = value
        this.$refs.userFactory.departId = ''
      },
      submitCurrForm() {
        this.$refs.form.validate(valid => {
@@ -450,22 +382,11 @@
        this.$refs.form.resetFields()
        this.model = {}
      },
      nodeSettingFormSubmit() {
        this.$refs.form.validate(valid => {
          if (valid) {
            console.log('Received values of form: ', this.model)
          }
        })
      },
      openSelect() {
        this.$refs.sysDirectiveModal.show()
      },
      handleAdd(num) {
        if (num == 1) {
          this.$refs.departModal.add()
          this.$refs.departModal.title = '新增'
        } else if (num == 2) {
          console.log(this.currSelected)
          let key = this.currSelected.key
          if (!key) {
            // this.$message.warning('请先点击选中上级车间!')
@@ -487,7 +408,7 @@
        if (this.currSelected.leaf) {
          this.$confirm({
            title: '确认删除',
            content: `确定要删除 ${that.currSelected.productionName} å—?`,
            content: `确定要删除 ${that.currSelected.factoryName} å—?`,
            onOk: function() {
              deleteByFactory({ id: that.currSelected.id }).then((resp) => {
                if (resp.success) {
@@ -499,13 +420,8 @@
                    description: '删除成功'
                  })
                  that.loadTree()
                  //删除后同步清空右侧基本信息内容
                  // let orgCode=that.model.orgCode;
                  // if(orgCode && orgCode === that.rightClickSelectedOrgCode){
                  that.onClearSelected()
                  // }
                } else {
                  // that.$message.warning('删除失败!')
                  that.$notification.warning({
                    message: '消息',
                    description: '删除失败'
@@ -519,28 +435,6 @@
            message: '消息',
            description: '此车间已挂载子节点'
          })
        }
        console.log('deletedRecord', deletedRecord)
      },
      selectDirectiveOk(record) {
        console.log('选中指令数据', record)
        this.nodeSettingForm.setFieldsValue({ directiveCode: record.directiveCode })
        this.currSelected.sysCode = record.sysCode
      },
      getFlowGraphData(node) {
        this.graphDatasource.nodes.push({
          id: node.id,
          text: node.flowNodeName
        })
        if (node.children.length > 0) {
          for (let a = 0; a < node.children.length; a++) {
            let temp = node.children[a]
            this.graphDatasource.edges.push({
              source: node.id,
              target: temp.id
            })
            this.getFlowGraphData(temp)
          }
        }
      },
      //---- author:os_chengtgen -- date:20190827 --  for:切换父子勾选模式 =======------
@@ -566,7 +460,6 @@
        }
      },
      getAllKeys(node) {
        // console.log('node',node);
        this.allTreeKeys.push(node.key)
        if (node.children && node.children.length > 0) {
          for (let a = 0; a < node.children.length; a++) {
src/views/base/SupplierList.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,383 @@
<template>
  <a-card
    :bordered="false"
    title="供应商"
  >
    <!-- æŸ¥è¯¢åŒºåŸŸ -->
    <div class="table-page-search-wrapper">
      <a-form
        layout="inline"
        @keyup.enter.native="searchQuery"
      >
        <a-row :gutter="30">
          <a-col
            :md="6"
            :sm="24"
          >
            <a-form-item label="供应商编号">
              <j-input
                placeholder="请输入供应商编号检索"
                v-model="queryParam.supplierCode"
              ></j-input>
            </a-form-item>
          </a-col>
          <a-col
            :md="6"
            :sm="24"
          >
            <a-form-item label="供应商名称">
              <j-input
                placeholder="请输入供应商名称检索"
                v-model="queryParam.supplierName"
              ></j-input>
            </a-form-item>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- æ“ä½œæŒ‰é’®åŒºåŸŸ -->
    <div class="table-operator">
      <a-button
        type="primary"
        @click="searchQuery"
        icon="search"
      >查询</a-button>
      <a-button
        type="primary"
        @click="searchReset"
        icon="reload"
      >重置</a-button>
      <a-button
        @click="handleAdd"
        type="primary"
        icon="plus"
      >新增</a-button>
    </div>
    <!-- table区域-begin -->
    <div>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        filterMultiple="filterMultiple"
        :columns="columns"
        :rowClassName="tableRowClass"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange,type:type}"
        @change="handleTableChange"
        :customRow="clickThenCheck"
      >
        <span
          slot="partCount"
          slot-scope="text,record"
          class="fontweight"
        >
          {{record.partCount}}
        </span>
        <!--状态栏个性展示-->
        <span
          slot="status"
          slot-scope="text,record"
        >
          <a-badge
            v-if="record.supplierStatus==1"
            status="success"
          />
          <span
            v-if="record.supplierStatus==1"
            class="success"
          >启用</span>
          <a-badge
            v-if="record.supplierStatus==0"
            status="error"
          />
          <span
            v-if="record.supplierStatus==0"
            class="error"
          >禁用</span>
        </span>
        <span
          slot="action"
          slot-scope="text, record"
        >
          <a
            href="javascript:;"
            @click="handleDetail(record)"
          >详情</a>
          <a-divider type="vertical" />
          <a-dropdown>
            <a class="ant-dropdown-link">更多
              <a-icon type="down" />
            </a>
            <a-menu slot="overlay">
              <a-menu-item>
                <a @click="handleEdit(record)">编辑</a>
              </a-menu-item>
              <a-menu-item>
                <a-popconfirm
                  title="确定删除吗?"
                  @confirm="() => handleDelete(record.id)"
                >
                  <a>删除</a>
                </a-popconfirm>
              </a-menu-item>
              <a-menu-item v-if="record.supplierStatus == 0">
                <a-popconfirm
                  title="确定启用吗?"
                  @confirm="() => handleActive(record.id)"
                >
                  <a>启用</a>
                </a-popconfirm>
              </a-menu-item>
              <a-menu-item v-if="record.supplierStatus == 1">
                <a-popconfirm
                  title="确定禁用吗?"
                  @confirm="() => handleActive(record.id)"
                >
                  <a>禁用</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>
      </a-table>
    </div>
    <!-- table区域-end -->
    <!-- è¡¨å•区域 -->
    <supplier-model
      ref="modalForm"
      @ok="modalFormOk"
    ></supplier-model>
  </a-card>
</template>
<script>
//按需引入 ç»„ä»¶
import SupplierModel from './modules/supplier/SupplierModel'
import { deleteAction, requestPut, getAction } from '@/api/manage'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import JEllipsis from '@/components/jeecg/JEllipsis'
import JInput from '@/components/jeecg/JInput'
export default {
  name: 'SupplierList',
  mixins: [JeecgListMixin],
  components: {
    SupplierModel,
    JEllipsis,
    JInput,
  },
  data() {
    return {
      selectedRowRecord: {},
      dataSource: [],
      partCount: "",
      /* åˆ†é¡µå‚æ•° */
      ipagination: {
        current: 1,
        pageSize: 5,
        pageSizeOptions: ['5', '10', '20'],
        showTotal: (total, range) => {
          return range[0] + "-" + range[1] + " å…±" + total + "条"
        },
        showQuickJumper: true,
        showSizeChanger: true,
        total: 0
      },
      // è¡¨å¤´
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: "center",
          customRender: function (t, r, index) {
            return parseInt(index) + 1;
          }
        },
        {
          title: '供应商编号',
          align: "center",
          dataIndex: 'supplierCode'
        },
        {
          title: '供应商名称',
          align: "center",
          dataIndex: 'supplierName'
        },
        {
          title: '国家',
          align: 'center',
          dataIndex: 'country'
        },
        {
          title: '省份',
          align: 'center',
          dataIndex: 'province'
        },
        {
          title: '城市',
          align: 'center',
          dataIndex: 'city'
        },
        {
          title: '详细地址',
          align: 'center',
          dataIndex: 'address'
        },
        {
          title: '联系人',
          align: 'center',
          dataIndex: 'contact'
        },
        {
          title: '电话',
          align: 'center',
          dataIndex: 'phone'
        },
        {
          width: 100,
          title: '状态',
          align: 'center',
          scopedSlots: {
            customRender: 'status',
          },
          dataIndex: 'supplierStatus'
        },
        {
          width: 150,
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          scopedSlots: { customRender: 'action' },
        }
      ],
      type: "radio",
      url: {
        list: '/base/supplier/list',
        delete: '/base/supplier/delete',
        active: '/base/supplier/active',
      },
    }
  },
  mounted() {
    this.$bus.$on('refreshParentPage', (data) => {
      this.loadData();
    })
  },
  methods: {
    loadData(arg) {
      if (arg === 1) {
        this.ipagination.current = 1;
      }
      var params = this.getQueryParams();//查询条件
      this.loading = true;
      getAction(this.url.list, params).then((res) => {
        if (res.success) {
          this.dataSource = res.result.records;
          this.ipagination.total = res.result.total;
        }
        if (res.code === 510) {
          this.$message.warning(res.message)
        }
        this.loading = false;
      })
    },
    //禁用状态样式
    tableRowClass(record, index) {
      if (record.supplierStatus != "1") {
        return "frozenRowClass";
      }
      return "";
    },
    //启用禁用
    handleActive(id) {
      if (!this.url.active) {
        this.$message.error("请设置url.active!")
        return
      }
      let that = this;
      requestPut(that.url.active, {}, { id: id }).then((res) => {
        if (res.success) {
          that.$message.success(res.message);
          that.loadData();
        } else {
          that.$message.warning(res.message);
        }
      });
    },
    clickThenCheck(record) {
      return {
        on: {
          click: (e) => {
            this.selectedRowRecord = record;
            this.onSelectChange(record.id.split(","), [record]);
          }
        }
      };
    },
    onSelectChange(selectedRowKeys) {
      this.selectedRowKeys = selectedRowKeys;
    },
  },
}
</script>
<style lang="less" scoped>
@import '~@assets/less/common.less';
.frozenRowClass {
  color: #c9c9c9;
}
.success {
  color: green;
}
.error {
  color: red;
}
.fontweight {
  font-weight: bold;
}
.ant-card-body .table-operator {
  margin-bottom: 18px;
}
.ant-table-tbody .ant-table-row td {
  padding-top: 15px;
  padding-bottom: 15px;
}
.anty-row-operator button {
  margin: 0 5px;
}
/deep/.ant-btn-danger {
  background-color: #ffffff;
}
.ant-modal-cust-warp {
  height: 100%;
}
.ant-modal-cust-warp .ant-modal-body {
  height: calc(100% - 110px) !important;
  overflow-y: auto;
}
.ant-modal-cust-warp .ant-modal-content {
  height: 90% !important;
  overflow-y: hidden;
}
</style>
src/views/base/WarehouseList.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,356 @@
<template>
  <a-card
    :bordered="false"
    title="供应商"
  >
    <!-- æŸ¥è¯¢åŒºåŸŸ -->
    <div class="table-page-search-wrapper">
      <a-form
        layout="inline"
        @keyup.enter.native="searchQuery"
      >
        <a-row :gutter="30">
          <a-col
            :md="6"
            :sm="24"
          >
            <a-form-item label="仓库编号">
              <j-input
                placeholder="请输入仓库编号检索"
                v-model="queryParam.warehouseCode"
              ></j-input>
            </a-form-item>
          </a-col>
          <a-col
            :md="6"
            :sm="24"
          >
            <a-form-item label="仓库名称">
              <j-input
                placeholder="请输入仓库名称检索"
                v-model="queryParam.warehouseName"
              ></j-input>
            </a-form-item>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- æ“ä½œæŒ‰é’®åŒºåŸŸ -->
    <div class="table-operator">
      <a-button
        type="primary"
        @click="searchQuery"
        icon="search"
      >查询</a-button>
      <a-button
        type="primary"
        @click="searchReset"
        icon="reload"
      >重置</a-button>
      <a-button
        @click="handleAdd"
        type="primary"
        icon="plus"
      >新增</a-button>
    </div>
    <!-- table区域-begin -->
    <div>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        filterMultiple="filterMultiple"
        :columns="columns"
        :rowClassName="tableRowClass"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange,type:type}"
        @change="handleTableChange"
        :customRow="clickThenCheck"
      >
        <span
          slot="partCount"
          slot-scope="text,record"
          class="fontweight"
        >
          {{record.partCount}}
        </span>
        <!--状态栏个性展示-->
        <span
          slot="status"
          slot-scope="text,record"
        >
          <a-badge
            v-if="record.warehouseStatus==1"
            status="success"
          />
          <span
            v-if="record.warehouseStatus==1"
            class="success"
          >启用</span>
          <a-badge
            v-if="record.warehouseStatus==0"
            status="error"
          />
          <span
            v-if="record.warehouseStatus==0"
            class="error"
          >禁用</span>
        </span>
        <span
          slot="action"
          slot-scope="text, record"
        >
          <a
            href="javascript:;"
            @click="handleDetail(record)"
          >详情</a>
          <a-divider type="vertical" />
          <a-dropdown>
            <a class="ant-dropdown-link">更多
              <a-icon type="down" />
            </a>
            <a-menu slot="overlay">
              <a-menu-item>
                <a @click="handleEdit(record)">编辑</a>
              </a-menu-item>
              <a-menu-item>
                <a-popconfirm
                  title="确定删除吗?"
                  @confirm="() => handleDelete(record.id)"
                >
                  <a>删除</a>
                </a-popconfirm>
              </a-menu-item>
              <a-menu-item v-if="record.warehouseStatus == 0">
                <a-popconfirm
                  title="确定启用吗?"
                  @confirm="() => handleActive(record.id)"
                >
                  <a>启用</a>
                </a-popconfirm>
              </a-menu-item>
              <a-menu-item v-if="record.warehouseStatus == 1">
                <a-popconfirm
                  title="确定禁用吗?"
                  @confirm="() => handleActive(record.id)"
                >
                  <a>禁用</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>
      </a-table>
    </div>
    <!-- table区域-end -->
    <!-- è¡¨å•区域 -->
    <warehouse-model
      ref="modalForm"
      @ok="modalFormOk"
    ></warehouse-model>
  </a-card>
</template>
<script>
//按需引入 ç»„ä»¶
import WarehouseModel from './modules/warehouse/WarehouseModel'
import { deleteAction, requestPut, getAction } from '@/api/manage'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import JEllipsis from '@/components/jeecg/JEllipsis'
import JInput from '@/components/jeecg/JInput'
export default {
  name: 'WarehouseList',
  mixins: [JeecgListMixin],
  components: {
    WarehouseModel,
    JEllipsis,
    JInput,
  },
  data() {
    return {
      selectedRowRecord: {},
      dataSource: [],
      partCount: "",
      /* åˆ†é¡µå‚æ•° */
      ipagination: {
        current: 1,
        pageSize: 5,
        pageSizeOptions: ['5', '10', '20'],
        showTotal: (total, range) => {
          return range[0] + "-" + range[1] + " å…±" + total + "条"
        },
        total: 0
      },
      // è¡¨å¤´
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: "center",
          customRender: function (t, r, index) {
            return parseInt(index) + 1;
          }
        },
        {
          title: '线边库编号',
          align: "center",
          dataIndex: 'warehouseCode'
        },
        {
          title: '线边库名称',
          align: "center",
          dataIndex: 'warehouseName'
        },
        {
          title: '产线',
          align: 'center',
          dataIndex: 'factoryId_dictText'
        },
        {
          width: 100,
          title: '状态',
          align: 'center',
          scopedSlots: {
            customRender: 'status',
          },
          dataIndex: 'warehouseStatus'
        },
        {
          width: 150,
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          scopedSlots: { customRender: 'action' },
        }
      ],
      type: "radio",
      url: {
        list: '/base/lineSideWarehouse/list',
        delete: '/base/lineSideWarehouse/delete',
        active: '/base/lineSideWarehouse/active',
      },
    }
  },
  mounted() {
    this.$bus.$on('refreshParentPage', (data) => {
      this.loadData();
    })
  },
  methods: {
    loadData(arg) {
      if (arg === 1) {
        this.ipagination.current = 1;
      }
      var params = this.getQueryParams();//查询条件
      this.loading = true;
      getAction(this.url.list, params).then((res) => {
        if (res.success) {
          this.dataSource = res.result.records;
          this.ipagination.total = res.result.total;
        }
        if (res.code === 510) {
          this.$message.warning(res.message)
        }
        this.loading = false;
      })
    },
    //禁用状态样式
    tableRowClass(record, index) {
      if (record.warehouseStatus != "1") {
        return "frozenRowClass";
      }
      return "";
    },
    //启用禁用
    handleActive(id) {
      if (!this.url.active) {
        this.$message.error("请设置url.active!")
        return
      }
      let that = this;
      requestPut(that.url.active, {}, { id: id }).then((res) => {
        if (res.success) {
          that.$message.success(res.message);
          that.loadData();
        } else {
          that.$message.warning(res.message);
        }
      });
    },
    clickThenCheck(record) {
      return {
        on: {
          click: (e) => {
            this.selectedRowRecord = record;
            this.onSelectChange(record.id.split(","), [record]);
          }
        }
      };
    },
    onSelectChange(selectedRowKeys) {
      this.selectedRowKeys = selectedRowKeys;
    },
  },
}
</script>
<style lang="less" scoped>
@import '~@assets/less/common.less';
.frozenRowClass {
  color: #c9c9c9;
}
.success {
  color: green;
}
.error {
  color: red;
}
.fontweight {
  font-weight: bold;
}
.ant-card-body .table-operator {
  margin-bottom: 18px;
}
.ant-table-tbody .ant-table-row td {
  padding-top: 15px;
  padding-bottom: 15px;
}
.anty-row-operator button {
  margin: 0 5px;
}
/deep/.ant-btn-danger {
  background-color: #ffffff;
}
.ant-modal-cust-warp {
  height: 100%;
}
.ant-modal-cust-warp .ant-modal-body {
  height: calc(100% - 110px) !important;
  overflow-y: auto;
}
.ant-modal-cust-warp .ant-modal-content {
  height: 90% !important;
  overflow-y: hidden;
}
</style>
src/views/base/modules/FactoryManager/SelectUserModal.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,287 @@
<template>
  <div>
    <a-modal
      centered
      :title="title"
      :width="1000"
      :visible="visible"
      @ok="handleOk"
      @cancel="handleCancel"
      cancelText="关闭">
      <!-- æŸ¥è¯¢åŒºåŸŸ -->
      <div class="table-page-search-wrapper">
        <a-form layout="inline"  @keyup.enter.native="searchQuery">
          <a-row :gutter="24">
            <a-col :span="10">
              <a-form-item label="用户账号">
                <a-input placeholder="请输入用户账号" v-model="queryParam.username"></a-input>
              </a-form-item>
            </a-col>
            <a-col :span="8">
                    <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
                      <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
                      <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
                    </span>
            </a-col>
          </a-row>
        </a-form>
      </div>
      <!-- table区域-begin -->
      <div>
        <a-table
          size="small"
          bordered
          rowKey="id"
          :columns="columns1"
          :dataSource="dataSource1"
          :pagination="ipagination"
          :loading="loading"
          :scroll="{ y: 240 }"
          :rowSelection="{selectedRowKeys: selectedRowKeys,onSelectAll:onSelectAll,onSelect:onSelect,onChange: onSelectChange}"
          @change="handleTableChange">
        </a-table>
      </div>
      <!-- table区域-end -->
    </a-modal>
  </div>
</template>
<script>
  import {filterObj} from '@/utils/util'
  import {getAction} from '@/api/manage'
  export default {
    name: "SelectUserModal",
    data() {
      return {
        title: "添加产线人员",
        names: [],
        visible: false,
        placement: 'right',
        description: '',
        // æŸ¥è¯¢æ¡ä»¶
        queryParam: {},
        // è¡¨å¤´
        columns1: [
          {
            title: '#',
            dataIndex: '',
            key: 'rowIndex',
            width: 50,
            align: "center",
            customRender: function (t, r, index) {
              return parseInt(index) + 1;
            }
          },
          {
            title: '用户账号',
            align: "center",
            width: 100,
            dataIndex: 'username'
          },
          {
            title: '用户名称',
            align: "center",
            width: 100,
            dataIndex: 'realname'
          },
          {
            title: '性别',
            align: "center",
            width: 100,
            dataIndex: 'sex_dictText'
          },
          {
            title: '电话',
            align: "center",
            width: 100,
            dataIndex: 'phone'
          },
          {
            title: '部门',
            align: "center",
            width: 150,
            dataIndex: 'orgCode'
          }
        ],
        columns2: [
          {
            title: '用户账号',
            align: "center",
            dataIndex: 'username',
          },
          {
            title: '用户名称',
            align: "center",
            dataIndex: 'realname',
          },
          {
            title: '操作',
            dataIndex: 'action',
            align: "center",
            width: 100,
            scopedSlots: {customRender: 'action'},
          }
        ],
        //数据集
        dataSource1: [],
        dataSource2: [],
        // åˆ†é¡µå‚æ•°
        ipagination: {
          current: 1,
          pageSize: 10,
          pageSizeOptions: ['10', '20', '30'],
          showTotal: (total, range) => {
            return range[0] + "-" + range[1] + " å…±" + total + "条"
          },
          showQuickJumper: true,
          showSizeChanger: true,
          total: 0
        },
        isorter: {
          column: 'createTime',
          order: 'desc',
        },
        loading: false,
        selectedRowKeys: [],
        selectedRows: [],
        url: {
          list: "/sys/user/list",
        }
      }
    },
    created() {
      this.loadData();
    },
    methods: {
      searchQuery() {
        this.loadData(1);
      },
      searchReset() {
        this.queryParam = {};
        this.loadData(1);
      },
      handleCancel() {
        this.visible = false;
      },
      handleOk() {
        this.dataSource2 = this.selectedRowKeys;
        console.log("data:" + this.dataSource2);
        this.$emit("selectFinished", this.dataSource2);
        this.visible = false;
      },
      add() {
        this.visible = true;
      },
      loadData(arg) {
        //加载数据 è‹¥ä¼ å…¥å‚æ•°1则加载第一页的内容
        if (arg === 1) {
          this.ipagination.current = 1;
        }
        var params = this.getQueryParams();//查询条件
        getAction(this.url.list, params).then((res) => {
          if (res.success) {
            this.dataSource1 = res.result.records;
            this.ipagination.total = res.result.total;
          }
        })
      },
      getQueryParams() {
        var param = Object.assign({}, this.queryParam, this.isorter);
        param.field = this.getQueryField();
        param.pageNo = this.ipagination.current;
        param.pageSize = this.ipagination.pageSize;
        return filterObj(param);
      },
      getQueryField() {
        //TODO å­—段权限控制
      },
      onSelectAll(selected, selectedRows, changeRows) {
        if (selected === true) {
          for (var a = 0; a < changeRows.length; a++) {
            this.dataSource2.push(changeRows[a]);
          }
        } else {
          for (var b = 0; b < changeRows.length; b++) {
            this.dataSource2.splice(this.dataSource2.indexOf(changeRows[b]), 1);
          }
        }
        // console.log(selected, selectedRows, changeRows);
      },
      onSelect(record, selected) {
        if (selected === true) {
          this.dataSource2.push(record);
        } else {
          var index = this.dataSource2.indexOf(record);
          //console.log();
          if (index >= 0) {
            this.dataSource2.splice(this.dataSource2.indexOf(record), 1);
          }
        }
      },
      onSelectChange(selectedRowKeys, selectedRows) {
        this.selectedRowKeys = selectedRowKeys;
        this.selectionRows = selectedRows;
      },
      onClearSelected() {
        this.selectedRowKeys = [];
        this.selectionRows = [];
      },
      handleDelete: function (record) {
        this.dataSource2.splice(this.dataSource2.indexOf(record), 1);
      },
      handleTableChange(pagination, filters, sorter) {
        //分页、排序、筛选变化时触发
        console.log(sorter);
        //TODO ç­›é€‰
        if (Object.keys(sorter).length > 0) {
          this.isorter.column = sorter.field;
          this.isorter.order = "ascend" == sorter.order ? "asc" : "desc"
        }
        this.ipagination = pagination;
        this.loadData();
      }
    }
  }
</script>
<style lang="less" scoped>
  .ant-card-body .table-operator {
    margin-bottom: 18px;
  }
  .ant-table-tbody .ant-table-row td {
    padding-top: 15px;
    padding-bottom: 15px;
  }
  .anty-row-operator button {
    margin: 0 5px
  }
  .ant-btn-danger {
    background-color: #ffffff
  }
  .ant-modal-cust-warp {
    height: 100%
  }
  .ant-modal-cust-warp .ant-modal-body {
    height: calc(100% - 110px) !important;
    overflow-y: auto
  }
  .ant-modal-cust-warp .ant-modal-content {
    height: 90% !important;
    overflow-y: hidden
  }
</style>
src/views/base/modules/FactoryManager/UserFactory.vue
ÎļþÃû´Ó src/views/base/modules/FactoryManager/FactoryEquipment.vue ÐÞ¸Ä
@@ -1,16 +1,16 @@
<template>
  <a-card :bordered="false">
    <template v-if="this.productionId">
    <template v-if="this.factoryId">
      <div class="table-page-search-wrapper">
        <a-form layout="inline" @keyup.enter.native="searchQuery">
          <a-row :gutter="24">
            <a-col :md="6" :sm="12">
              <a-form-item label="设备编号">
                <a-input placeholder="请输入设备编号" v-model="queryParam.equipmentId"></a-input>
            <a-col :md="12" :sm="12">
              <a-form-item label="人员编号">
                <a-input placeholder="请输入人员编号" v-model="queryParam.username"></a-input>
              </a-form-item>
            </a-col>
            <a-col :md="6" :sm="8">
            <a-col :md="12" :sm="12">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
            </a-col>
@@ -18,6 +18,8 @@
        </a-form>
      </div>
      <div class="table-operator" style="border-top: 5px">
        <a-button @click="handleAddUserFactory" type="primary" icon="plus" style="margin-top: 16px">添加产线人员</a-button>
        <a-dropdown v-if="selectedRowKeys.length > 0">
          <a-menu slot="overlay"  @click="handleMenuClick">
            <a-menu-item key="1">
@@ -44,12 +46,6 @@
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        @change="handleTableChange">
        <!--<template slot="avatarslot" slot-scope="text, record, index">-->
        <!--<div class="anty-img-wrap">-->
        <!--<a-avatar shape="square" :src="getAvatarView(record.avatar)" icon="user"/>-->
        <!--</div>-->
        <!--</template>-->
        <span slot="action" slot-scope="text, record">
        <a-popconfirm title="确定移除吗?" @confirm="() => handleDelete(record.id)">
                  <a>移除</a>
@@ -59,21 +55,24 @@
    </template>
    <a-card v-else :bordered="false" style="height:200px">
      <a-empty>
        <span slot="description"> è¯·å…ˆé€‰æ‹©ä¸€ä¸ªéƒ¨é—¨! </span>
        <span slot="description"> è¯·å…ˆé€‰æ‹©ä¸€ä¸ªäº§çº¿! </span>
      </a-empty>
    </a-card>
     <Select-User-Modal ref="selectUserModal" @selectFinished="selectOK"></Select-User-Modal>
  </a-card>
</template>
<script>
  import { filterObj } from '@/utils/util';
  import {queryTreeListForRole,queryDepartPermission,saveDepartPermission} from '@/api/api'
  import {JeecgListMixin} from '@/mixins/JeecgListMixin'
  import { getAction,postAction } from '@/api/manage'
  import qs from 'qs'
  import { getAction,postAction,deleteAction } from '@/api/manage'
  import SelectUserModal from './SelectUserModal'
  export default {
    name: 'FactoryEquipment',
    name: 'UserFactory',
    mixins: [JeecgListMixin],
    components: {
      SelectUserModal
    },
    data(){
      return {
        queryParam:{},
@@ -89,34 +88,17 @@
            }
          },
          {
            title: '设备编号',
            title: '人员编号',
            align: "center",
            dataIndex: 'equipmentId',
            dataIndex: 'username',
            width: 120,
            // sorter: true
          },
          {
            title: '设备名称',
            title: '人员名称',
            align: "center",
            width: 150,
            dataIndex: 'equipmentName',
            dataIndex: 'realname',
          },
          {
            title: '设备类型',
            align: "center",
            width: 120,
            dataIndex: 'equipmentType',
            // scopedSlots: {customRender: "avatarslot"}
          },
          {
            title: '驱动类型',
            align: "center",
            width: 80,
            dataIndex: 'driveType',
            // sorter: true
          },
          {
            title: '操作',
            dataIndex: 'action',
@@ -127,22 +109,23 @@
        ],
        disableMixinCreated:true,
        productionId:"",
        title:"部门权限配置",
        factoryId:"",
        title:"产线人员配置",
        visible: false,
        loading: false,
        url:{
          list:'/mdc/mdcEquipment/equipmentListByProduction',
          removeEquipmentForDepart:'/mdc/mdcEquipment/removeEquipmentForProduction',
          list:'/sys/user/userFactoryList',
          deleteUserFactory:'/sys/user/deleteUserFactory',
          serachEquipment:'/mdc/mdcEquipment/equipmentListByProduction',
          removeEquipmentsForProduction:"/mdc/mdcEquipment/removeEquipmentsForProduction"
          deleteBatch:"/sys/user/deleteUserFactoryBatch",
          addUserFactory:'/sys/user/addBaseUserFactory'
        }
      }
    },
    methods: {
      show(productionId){
        this.productionId=productionId
      show(factoryId){
        this.factoryId=factoryId
        this.loadData();
      },
      close () {
@@ -155,39 +138,14 @@
        this.loadData();
      },
      searchQuery() {
        var id = this.queryParam.equipmentId
        this.loading = true;
        var params = this.getQueryParams();//查询条件
        params.pageNo = this.ipagination.current;
        params.pageSize = this.ipagination.pageSize;
        getAction(this.url.serachEquipment,{equipmentId:this.queryParam.equipmentId,productionId:this.productionId,pageNo:params.pageNo,pageSize:params.pageSize}).then((res)=>{
          if (res.success) {
            // console.log(res)
            //update-begin---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
            this.dataSource = res.result.records||res.result;
            if(res.result.total)
            {
              this.ipagination.total = res.result.total;
            }else{
              this.ipagination.total = 0;
            }
            //update-end---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
          }else{
            // this.$message.warning(res.message)
            this.$notification.warning({
              message:'消息',
              description:res.message
            });
          }
        }).finally(() => {
          this.loading = false
        })
        this.loadData();
      },
      handleTableChange(pagination, filters, sorter) {
        //分页、排序、筛选变化时触发
        //TODO ç­›é€‰
        // console.log(pagination)
        if (Object.keys(sorter).length > 0) {
          this.isorter.column = sorter.field;
          this.isorter.order = "ascend" == sorter.order ? "asc" : "desc"
@@ -196,19 +154,12 @@
        this.loadData();
      },
      loadData(){
        //加载数据 è‹¥ä¼ å…¥å‚æ•°1则加载第一页的内容
        // if (arg === 1) {
        //   this.ipagination.current = 1;
        // }
        var params = this.getQueryParams();//查询条件
        params.pageNo = this.ipagination.current;
        params.pageSize = this.ipagination.pageSize;
        this.loading = true;
        getAction(this.url.list,params).then((res)=>{
          if (res.success) {
            // console.log(res)
            //update-begin---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
            this.dataSource = res.result.records||res.result;
            if(res.result.total)
            {
@@ -216,9 +167,7 @@
            }else{
              this.ipagination.total = 0;
            }
            //update-end---author:zhangyafei    Date:20201118  for:适配不分页的数据列表------------
          }else{
            // this.$message.warning(res.message)
            this.$notification.warning({
              message:'消息',
              description:res.message
@@ -239,7 +188,7 @@
        param.field = this.getQueryField();
        param.pageNo = this.ipagination.current;
        param.pageSize = this.ipagination.pageSize;
        param.productionId = this.productionId;
        param.factoryId = this.factoryId;
        //获取用户定制的参数属性
        if (this.getCustomQueryParams) {
          param = this.getCustomQueryParams(param);
@@ -250,15 +199,15 @@
        return filterObj(param);
      },
      handleDelete(equipmentId){
      handleDelete(id){
        postAction(this.url.removeEquipmentForDepart,qs.stringify({productionId:this.productionId,equipmentId:equipmentId})).then((res)=>{
        deleteAction(this.url.deleteUserFactory,{factoryId:this.factoryId,userId:id}).then((res)=>{
          if (res.success) {
            this.$notification.success({
              message:'消息',
              description:res.message
            });
            this.loadData(this.productionId);
            this.loadData(this.factoryId);
          }else{
            this.$notification.warning({
              message:'消息',
@@ -275,8 +224,8 @@
        }
      },
      batchDel: function () {
        if(!this.url.removeEquipmentsForProduction){
          this.$message.error("请设置url.removeEquipmentsForProduction属性!")
        if(!this.url.deleteBatch){
          this.$message.error("请设置url.deleteBatch属性!")
          return
        }
        if (this.selectedRowKeys.length <= 0) {
@@ -297,19 +246,17 @@
            content: "是否删除选中数据?",
            onOk: function () {
              that.loading = true;
              postAction(that.url.removeEquipmentsForProduction,qs.stringify({productionId:that.productionId,equipmentIds:ids})).then((res) => {
              deleteAction(that.url.deleteBatch,{factoryId:that.factoryId,userIds:ids}).then((res) => {
                if (res.success) {
                  //重新计算分页问题
                  that.reCalculatePage(that.selectedRowKeys.length)
                  // that.$message.success(res.message);
                  this.$notification.success({
                    message:'消息',
                    description:res.message
                  });
                  that.loadData(that.productionId);
                  that.loadData(that.factoryId);
                  that.onClearSelected();
                } else {
                  // that.$message.warning(res.message);
                  this.$notification.warning({
                    message:'消息',
                    description:res.message
@@ -322,6 +269,30 @@
          });
        }
      },
      handleAddUserFactory() {
        if (this.factoryId == '') {
          this.$message.error('请选择一个产线!')
        } else {
          this.$refs.selectUserModal.visible = true
        }
      },
      selectOK(data) {
        let params = {}
        params.factoryId = this.factoryId
        params.userIdList = []
        for (var a = 0; a < data.length; a++) {
          params.userIdList.push(data[a])
        }
        console.log(params)
        postAction(this.url.addUserFactory, params).then((res) => {
          if (res.success) {
            this.loadData()
            this.$message.success(res.message)
          } else {
            this.$message.warning(res.message)
          }
        })
      },
    },
  }
</script>
src/views/base/modules/supplier/SupplierModel.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,521 @@
<template>
  <a-modal
    :title="title"
    :width="800"
    :visible="visible"
    :confirmLoading="confirmLoading"
    :okButtonProps="{ props: {disabled: disableSubmit} }"
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭"
  >
    <a-spin :spinning="confirmLoading">
      <a-form :form="form">
        <a-row :gutter="24">
          <a-col :span="24">
            <a-form-item
              :labelCol="{span:3}"
              :wrapperCol="{span:21}"
              label="供应商编号"
            >
              <a-input
                :readOnly="disableSubmit"
                allow-clear
                placeholder="请输入供应商编号"
                v-decorator="['supplierCode', validatorRules.supplierCode ]"
              />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="24">
            <a-form-item
              :labelCol="{span:3}"
              :wrapperCol="{span:21}"
              label="供应商名称"
            >
              <a-input
                :readOnly="disableSubmit"
                allow-clear
                placeholder="请输入供应商名称"
                v-decorator="['supplierName', validatorRules.supplierName ]"
              />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="国家"
            >
            <a-input
                :readOnly="disableSubmit"
                allow-clear
                placeholder="请输入国家"
                v-decorator="['country', validatorRules.country ]"
              />
              <!-- <j-dict-select-tag
                :disabled="disableSubmit"
                placeholder="请选择国家"
                :triggerChange="true"
                dictCode="country_list"
                v-decorator="['country', validatorRules.country]"
              /> -->
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="省份"
            >
              <a-input
                :readOnly="disableSubmit"
                allow-clear
                placeholder="请输入省份"
                v-decorator="['province', validatorRules.province ]"
              />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="城市"
            >
              <a-input
                :readOnly="disableSubmit"
                allow-clear
                placeholder="请输入城市"
                v-decorator="['city', validatorRules.city ]"
              />
            </a-form-item>
          </a-col>
           <a-col :span="12">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="联系人"
            >
              <a-input
                :readOnly="disableSubmit"
                allow-clear
                placeholder="请输入联系人"
                v-decorator="['contact', validatorRules.contact]"
              />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
           <a-col :span="24">
            <a-form-item
              :labelCol="{span:3}"
              :wrapperCol="{span:21}"
              label="详细地址"
            >
              <a-input
                :readOnly="disableSubmit"
                allow-clear
                placeholder="请输入详细地址"
                v-decorator="['address', validatorRules.address]"
              />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="邮箱"
            >
              <a-input
                :readOnly="disableSubmit"
                allow-clear
                placeholder="请输入邮箱"
                v-decorator="['email', validatorRules.email]"
              />
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="邮编"
            >
              <a-input
                :readOnly="disableSubmit"
                allow-clear
                placeholder="请输入邮编"
                v-decorator="['postcode', validatorRules.postcode]"
              />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="传真"
            >
              <a-input
                :readOnly="disableSubmit"
                allow-clear
                placeholder="请输入传真"
                v-decorator="['fax', validatorRules.fax]"
              />
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="手机号码"
            >
              <a-input
                :readOnly="disableSubmit"
                allow-clear
                placeholder="请输入手机号码"
                v-decorator="['phone', validatorRules.phone]"
              />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="公司电话"
            >
              <a-input
                :readOnly="disableSubmit"
                allow-clear
                placeholder="请输入公司电话"
                v-decorator="['companyTelephone', validatorRules.companyTelephone]"
              />
            </a-form-item>
          </a-col>
          <a-col :span="12">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="官方网站"
            >
              <a-input
                :readOnly="disableSubmit"
                allow-clear
                placeholder="请输入官方网站"
                v-decorator="['officialWebsite', validatorRules.officialWebsite]"
              />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="24">
            <a-form-item
              :labelCol="{span:3}"
              :wrapperCol="{span:21}"
              label="备注"
            >
              <a-textarea
                :readOnly="disableSubmit"
                placeholder="请输入备注"
                allow-clear
                v-decorator="['remark', validatorRules.remark]"
              />
            </a-form-item>
          </a-col>
        </a-row>
      </a-form>
    </a-spin>
  </a-modal>
</template>
<script>
import { httpAction, getAction } from '@/api/manage'
import JDate from '@/components/jeecg/JDate'
import pick from 'lodash.pick'
import moment from 'moment'
import { duplicateCheck } from '@/api/api'//重复校验
import JTreeDict from '@/components/jeecg/JTreeDict'//分类字典树形下拉组件
export default {
  name: "SpplierModal",
  components: {
    JDate,
    JTreeDict,
  },
  data() {
    return {
      editorValue: '',
      title: "操作",
      visible: false,
      disableSubmit: false,
      model: {},
      treeData: [],
      supplierId: "", //保存供应商id
      labelCol: {
        xs: { span: 24 },
        sm: { span: 6 },
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 18 },
      },
      confirmLoading: false,
      form: this.$form.createForm(this),
      validatorRules: {
        supplierCode: {
          rules: [
            { required: true, message: '请输入编号' },
            { min: 2, max: 30, message: '长度在 2 åˆ° 30 ä¸ªå­—符', trigger: 'blur' },
            { validator: this.validateNum },
          ]
        },
        supplierName: {
          rules: [
            { required: true, message: '请输入名称' },
            { min: 0, max: 64, message: '长度不超过 64 ä¸ªå­—符', trigger: 'blur' },
            { validator: this.validateName },
          ]
        },
        country: {
          rules: [
            { required: true, message: '请选择国家' },
          ]
        },
        address: {
          rules: [
            { min: 0, max: 100, message: '最长 100 ä¸ªå­—符', trigger: 'blur' },
          ]
        },
        postcode: {
          rules: [
            { pattern: /^[0-9]{6}$/, message: '请输入正确邮编' },
          ]
        },
        email: {
          rules: [
            { validator: this.validateEmail },
          ]
        },
        contact: {
          rules: [
            { min: 0, max: 30, message: '最长 30 ä¸ªå­—符', trigger: 'blur' },
          ]
        },
        fax: {
          rules: [
            { min: 0, max: 30, message: '最长 30 ä¸ªå­—符', trigger: 'blur' },
            // { pattern: /^0\d{2,3}-[1-9]\d{6,7}$/, message: '请输入正确传真' },
          ]
        },
        phone: {
          rules: [
            { validator: this.validatePhone },
          ]
        },
        companyTelephone: {
          rules: [
            { min: 0, max: 30, message: '最长 30 ä¸ªå­—符', trigger: 'blur' },
            // { pattern: /^0\d{2,3}-[1-9]\d{6,7}$/, message: '请输入正确座机号码' },
          ]
        },
        officialWebsite: {
          rules: [
            { pattern: /^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/|www\.)(([A-Za-z0-9-~]+)\.)+([A-Za-z0-9-~\/])+$/, message: '请输入正确网络地址' },
          ]
        },
        remark: {
          rules: [
            { min: 0, max: 100, message: '最长 100 ä¸ªå­—符', trigger: 'blur' },
          ]
        },
      },
      url: {
        add: "/base/supplier/add",
        edit: "/base/supplier/edit",
      },
    }
  },
  created() {
  },
  methods: {
    add() {
      this.edit({});
    },
    edit(record) {
      this.form.resetFields();
      this.model = Object.assign({}, record);
      this.supplierId = record.id;
      this.visible = true;
      this.$nextTick(() => {
        this.form.setFieldsValue(
          pick(this.model, 'supplierCode', 'supplierName', 'country','province','city', 'address', 'contact', 'postcode', 'fax', 'email', 'phone', 'companyTelephone', 'officialWebsite', 'remark')
        )
        //时间格式化
      });
    },
    close() {
      this.$emit('close');
      this.visible = false;
    },
    handleOk() {
      const that = this;
      // è§¦å‘表单验证
      this.form.validateFields((err, values) => {
        if (!err) {
          that.confirmLoading = true;
          let httpurl = '';
          let method = '';
          if (!this.model.id) {
            httpurl += this.url.add;
            method = 'post';
          } else {
            httpurl += this.url.edit;
            method = 'put';
          }
          let formData = Object.assign(this.model, values);
          httpAction(httpurl, formData, method).then((res) => {
            if (res.success) {
              that.$message.success(res.message);
              that.$emit('ok');
            } else {
              that.$message.warning(res.message);
            }
          }).finally(() => {
            that.confirmLoading = false;
            that.close();
          })
        }
      })
    },
    handleCancel() {
      this.close()
    },
    //验证 ç¼–号
    validateNum(rule, value, callback) {
      var params = {
        tableName: 'base_supplier',
        fieldName: 'supplier_code',
        fieldVal: value,
        dataId: this.supplierId,
        //数据库中存在字段del_flag并使用该字段作为未删除策略,真删除:false å‡åˆ é™¤ï¼štrue
        delFlag: 'true',
      };
      duplicateCheck(params).then((res) => {
        if (res.success) {
          callback();
        } else {
          callback("供应商编号已存在!");
        }
      })
    },
    //验证 åç§°
    validateName(rule, value, callback) {
      var params = {
        tableName: 'base_supplier',
        fieldName: 'supplier_name',
        fieldVal: value,
        dataId: this.supplierId,
        //数据库中存在字段del_flag并使用该字段作为未删除策略,真删除:false å‡åˆ é™¤ï¼štrue
        delFlag: 'true',
      };
      duplicateCheck(params).then((res) => {
        if (res.success) {
          callback();
        } else {
          callback("供应商名称已存在!");
        }
      })
    },
    //验证 æ‰‹æœºå·
    validatePhone(rule, value, callback) {
      if (!value) {
        callback()
      } else {
        //[05] æ‰‹æœºå·ä¸æ”¯æŒ199号码段--------------------
        if (new RegExp(/^1[3|4|5|7|8|9][0-9]\d{8}$/).test(value)) {
          var params = {
            tableName: 'base_supplier',
            fieldName: 'phone',
            fieldVal: value,
            dataId: this.supplierId
          };
          duplicateCheck(params).then((res) => {
            if (res.success) {
              callback()
            } else {
              callback("手机号已存在!")
            }
          })
        } else {
          callback("请输入正确格式的手机号码!");
        }
      }
    },
    //验证 Email
    validateEmail(rule, value, callback) {
      if (!value) {
        callback()
      } else {
        if (new RegExp(/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/).test(value)) {
          var params = {
            tableName: 'base_supplier',
            fieldName: 'email',
            fieldVal: value,
            dataId: this.supplierId
          };
          duplicateCheck(params).then((res) => {
            console.log(res)
            if (res.success) {
              callback()
            } else {
              callback("邮箱已存在!")
            }
          })
        } else {
          callback("请输入正确格式的邮箱!")
        }
      }
    },
  }
}
</script>
<style scoped>
.ant-btn {
  padding: 0 10px;
  margin-left: 3px;
}
.ant-form-item-control {
  line-height: 0px;
}
/** ä¸»è¡¨å•行间距 */
.ant-form .ant-form-item {
  margin-bottom: 10px;
}
/** Tab页面行间距 */
.ant-tabs-content .ant-form-item {
  margin-bottom: 0px;
}
</style>
src/views/base/modules/warehouse/WarehouseModel.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,238 @@
<template>
  <a-modal
    :title="title"
    :width="800"
    :visible="visible"
    :confirmLoading="confirmLoading"
    :okButtonProps="{ props: {disabled: disableSubmit} }"
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭"
  >
    <a-spin :spinning="confirmLoading">
      <a-form :form="form">
        <a-row :gutter="24">
          <a-col :span="24">
            <a-form-item
              :labelCol="{span:3}"
              :wrapperCol="{span:21}"
              label="线边库编号"
            >
              <a-input
                :readOnly="disableSubmit"
                allow-clear
                placeholder="请输入线边库编号"
                v-decorator="['warehouseCode', validatorRules.warehouseCode ]"
              />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="24">
            <a-form-item
              :labelCol="{span:3}"
              :wrapperCol="{span:21}"
              label="线边库名称"
            >
              <a-input
                :readOnly="disableSubmit"
                allow-clear
                placeholder="请输入线边库名称"
                v-decorator="['warehouseName', validatorRules.warehouseName ]"
              />
            </a-form-item>
          </a-col>
        </a-row>
        <a-row :gutter="24">
          <a-col :span="12">
            <a-form-item
              :labelCol="labelCol"
              :wrapperCol="wrapperCol"
              label="产线"
            >
            <j-dict-select-tag
                type="list"
                v-model="model.factoryId"
                :trigger-change="true"
                dictCode="base_factory,factory_name,id"
                placeholder="请选择产线"
              />
            </a-form-item>
          </a-col>
        </a-row>
      </a-form>
    </a-spin>
  </a-modal>
</template>
<script>
import { httpAction, getAction } from '@/api/manage'
import JDate from '@/components/jeecg/JDate'
import pick from 'lodash.pick'
import moment from 'moment'
import { duplicateCheck } from '@/api/api'//重复校验
import JTreeDict from '@/components/jeecg/JTreeDict'//分类字典树形下拉组件
export default {
  name: "WarehouseModal",
  components: {
    JDate,
    JTreeDict,
  },
  data() {
    return {
      title: "操作",
      visible: false,
      disableSubmit: false,
      model: {},
      treeData: [],
      warehouseId: "", //保存线边库id
      labelCol: {
        xs: { span: 24 },
        sm: { span: 6 },
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 18 },
      },
      confirmLoading: false,
      form: this.$form.createForm(this),
      validatorRules: {
        warehouseCode: {
          rules: [
            { required: true, message: '请输入线边库编号' },
            { min: 2, max: 30, message: '长度在 2 åˆ° 30 ä¸ªå­—符', trigger: 'blur' },
            { validator: this.validateNum },
          ]
        },
        warehouseName: {
          rules: [
            { required: true, message: '请输入线边库名称' },
            { min: 0, max: 64, message: '长度不超过 64 ä¸ªå­—符', trigger: 'blur' },
            { validator: this.validateName },
          ]
        },
      },
      url: {
        add: "/base/lineSideWarehouse/add",
        edit: "/base/lineSideWarehouse/edit",
      },
    }
  },
  created() {
  },
  methods: {
    add() {
      this.edit({});
    },
    edit(record) {
      this.form.resetFields();
      this.model = Object.assign({}, record);
      this.warehouseId = record.id;
      this.visible = true;
      this.$nextTick(() => {
        this.form.setFieldsValue(
          pick(this.model, 'warehouseCode', 'warehouseName', 'factoryId')
        )
      });
    },
    close() {
      this.$emit('close');
      this.visible = false;
    },
    handleOk() {
      const that = this;
      // è§¦å‘表单验证
      this.form.validateFields((err, values) => {
        if (!err) {
          that.confirmLoading = true;
          let httpurl = '';
          let method = '';
          if (!this.model.id) {
            httpurl += this.url.add;
            method = 'post';
          } else {
            httpurl += this.url.edit;
            method = 'put';
          }
          let formData = Object.assign(this.model, values);
          httpAction(httpurl, formData, method).then((res) => {
            if (res.success) {
              that.$message.success(res.message);
              that.$emit('ok');
            } else {
              that.$message.warning(res.message);
            }
          }).finally(() => {
            that.confirmLoading = false;
            that.close();
          })
        }
      })
    },
    handleCancel() {
      this.close()
    },
    //验证 ç¼–号
    validateNum(rule, value, callback) {
      var params = {
        tableName: 'base_line_side_warehouse',
        fieldName: 'warehouse_code',
        fieldVal: value,
        dataId: this.warehouseId,
        //数据库中存在字段del_flag并使用该字段作为未删除策略,真删除:false å‡åˆ é™¤ï¼štrue
        delFlag: 'true',
      };
      duplicateCheck(params).then((res) => {
        if (res.success) {
          callback();
        } else {
          callback("线边库编号已存在!");
        }
      })
    },
    //验证 åç§°
    validateName(rule, value, callback) {
      var params = {
        tableName: 'base_line_side_warehouse',
        fieldName: 'warehouse_name',
        fieldVal: value,
        dataId: this.warehouseId,
        //数据库中存在字段del_flag并使用该字段作为未删除策略,真删除:false å‡åˆ é™¤ï¼štrue
        delFlag: 'true',
      };
      duplicateCheck(params).then((res) => {
        if (res.success) {
          callback();
        } else {
          callback("线边库名称已存在!");
        }
      })
    },
  }
}
</script>
<style scoped>
.ant-btn {
  padding: 0 10px;
  margin-left: 3px;
}
.ant-form-item-control {
  line-height: 0px;
}
/** ä¸»è¡¨å•行间距 */
.ant-form .ant-form-item {
  margin-bottom: 10px;
}
/** Tab页面行间距 */
.ant-tabs-content .ant-form-item {
  margin-bottom: 0px;
}
</style>