whj 7 months ago
parent
commit
53bb9b8df3
2 changed files with 49 additions and 25 deletions
  1. 4 7
      src/views/store/store/Store.vue
  2. 45 18
      src/views/store/store/modules/BaseForm.vue

+ 4 - 7
src/views/store/store/Store.vue

@@ -79,14 +79,11 @@
       <span slot="action" slot-scope="record">
         <template>
           <a @click="handleView(record)">查看</a>
-          <a-divider v-if="$auth('store-stores-del')" type="vertical" />
-          <a v-if="$auth('store-stores-edit')" @click="handleEdit(record)">修改</a>
-          <a-divider v-if="$auth('store-stores-del')" type="vertical" />
-          <a-popconfirm v-if="$auth('store-stores-del')" title="删除仓库,将清空仓库所有物资数据??" @confirm="batchDelete(record.id)">
+          <operation-button @click="handleEdit(record)">修改</operation-button>
+          <operation-button v-if="$auth('store-stores-del')" :type="2" title="删除仓库,将清空仓库所有物资数据??" @confirm="batchDelete(record.id)">
             <a>删除</a>
-          </a-popconfirm>
-          <a-divider type="vertical" />
-          <a @click="changeStore(record)">迁移仓库</a>
+          </operation-button>
+          <operation-button @click="changeStore(record)">迁移仓库</operation-button>
           <!-- <a-divider type="vertical" />
            <a @click="doExportSpareStore(record)">导出库存</a>
            <a-divider type="vertical" />

+ 45 - 18
src/views/store/store/modules/BaseForm.vue

@@ -22,7 +22,7 @@
           v-decorator="['no', {rules: [{required: false, message: '编码不能为空'}]}]" />
       </a-form-item>
 
-<!--      <a-form-item
+      <!--      <a-form-item
         label="所属公司"
         :labelCol="BaseTool.Constant.labelCol"
         :wrapperCol="BaseTool.Constant.wrapperCol"
@@ -51,6 +51,21 @@
         </a-select>
       </a-form-item>-->
       <a-form-item
+        label="等級"
+        :labelCol="BaseTool.Constant.labelCol"
+        :wrapperCol="BaseTool.Constant.wrapperCol"
+      >
+        <a-select v-decorator="['level']" placeholder="请选择" @change="(val)=>level=val">
+          <a-select-option
+            v-for="(label,value) in levelMap"
+            :key="value"
+            :label="label"
+            :value="parseInt(value)">{{ label }}
+          </a-select-option>
+        </a-select>
+      </a-form-item>
+      <a-form-item
+        v-if="level===2"
         label="所属仓库"
         :labelCol="BaseTool.Constant.labelCol"
         :wrapperCol="BaseTool.Constant.wrapperCol"
@@ -61,11 +76,26 @@
           :treeData="storeTreeDate"
           :treeNodeFilterProp="'title'"
           :showSearch="true"
-          v-decorator="['parentId', {rules: [{required: false, message: '上层仓库不能为空'}]}]"
+          v-decorator="['parentId', {rules: [{required: true, message: '上层仓库不能为空'}]}]"
           placeholder="请选择"
         >
         </a-tree-select>
       </a-form-item>
+      <a-form-item
+        v-else-if="level===1"
+        label="所属厂区"
+        :labelCol="BaseTool.Constant.labelCol"
+        :wrapperCol="BaseTool.Constant.wrapperCol"
+      >
+        <a-select @change="handleProjectChange" v-decorator="['factoryArea', {rules: [{required: true, message: '所属厂区不能为空'}]}]" placeholder="请选择">
+          <a-select-option
+            v-for="({deptId, name}) in projectList"
+            :key="deptId"
+            :label="name"
+            :value="deptId">{{ name }}
+          </a-select-option>
+        </a-select>
+      </a-form-item>
       <a-form-item
         label="名称"
         :labelCol="BaseTool.Constant.labelCol"
@@ -88,21 +118,8 @@
           </a-select-option>
         </a-select>
       </a-form-item>
-      <a-form-item
-        label="等級"
-        :labelCol="BaseTool.Constant.labelCol"
-        :wrapperCol="BaseTool.Constant.wrapperCol"
-      >
-        <a-select v-decorator="['level']" placeholder="请选择">
-          <a-select-option
-            v-for="(label,value) in levelMap"
-            :key="value"
-            :label="label"
-            :value="parseInt(value)">{{ label }}
-          </a-select-option>
-        </a-select>
-      </a-form-item>
-<!--      <a-form-item
+
+      <!--      <a-form-item
         label="类型"
         :labelCol="BaseTool.Constant.labelCol"
         :wrapperCol="BaseTool.Constant.wrapperCol"
@@ -126,7 +143,7 @@
           :min="1"
           v-decorator="['sort', {initialValue:1,rules: [{required: true, message: '排序不能为空'}]}]" />
       </a-form-item>
-<!--      <a-form-item
+      <!--      <a-form-item
         label="是否删除"
         :labelCol="BaseTool.Constant.labelCol"
         :wrapperCol="BaseTool.Constant.wrapperCol"
@@ -149,6 +166,15 @@
           :rows="4"
           v-decorator="['remark', {rules: [{required: false, message: '备注不能为空'}]}]"/>
       </a-form-item>
+      <a-form-item
+        label="是否存在库位"
+        :labelCol="BaseTool.Constant.labelCol"
+        :wrapperCol="BaseTool.Constant.wrapperCol"
+      >
+        <a-switch
+          :rows="4"
+          v-decorator="['remark', {rules: [{required: false, message: '备注不能为空'}]}]"/>
+      </a-form-item>
     </a-form>
     <template slot="footer">
       <a-button :loading="confirmLoading" type="primary" @click="save()">保存</a-button>
@@ -168,6 +194,7 @@ export default {
     return {
       confirmLoading: false,
       modalTitle: null,
+      level: null,
       form: this.$form.createForm(this),
       visible: false,
       // 下拉框map