Sfoglia il codice sorgente

物理申请单重构

002390 1 anno fa
parent
commit
b1a080c1ab

+ 2 - 0
src/components/BatchImport/index.vue

@@ -139,6 +139,8 @@ export default {
     :size="size"
     @click="open"
     type="primary"
+    v-bind="$attrs"
+    v-on="$listeners"
   >
     {{ title }}
     <el-dialog 

+ 34 - 35
src/components/popover-select-v2/index.vue

@@ -6,7 +6,7 @@ export default {
   props: {
     // v-model
     value: {
-      type: [Array, String,Number],
+      type: [Array, String, Number],
       require: true,
     },
     // 参照类型 ,对应后端
@@ -49,11 +49,15 @@ export default {
       },
     },
     // 赋值
-    copy:{
-      type:Boolean,
-      default:() =>{
-        return false
-      }
+    copy: {
+      type: Boolean,
+      default: () => {
+        return false;
+      },
+    },
+    clearable: {
+      type: Boolean,
+      default: true,
     },
   },
   components: {
@@ -134,23 +138,18 @@ export default {
         if (code === 200) {
           this.data = rows;
 
-
           // 处理新增字段无法映射
           let that = this;
 
-          this.TableColumns.forEach(({item,attr}) =>{
-
-            that.data = that.data.map(d =>{
-
-              if(!attr.is && attr.formatter){
+          this.TableColumns.forEach(({ item, attr }) => {
+            that.data = that.data.map((d) => {
+              if (!attr.is && attr.formatter) {
                 d[item.key] = attr.formatter(d);
               }
 
               return d;
-
-            })
-
-          })
+            });
+          });
 
           this.page.total = total;
         }
@@ -209,7 +208,6 @@ export default {
           }),
           this.$props
         );
-
       } else {
         for (let key in dataMapping) {
           source[key] = prop[0][dataMapping[key]];
@@ -219,27 +217,24 @@ export default {
         this.$emit("change", prop[0], this.$props);
       }
     },
-    async handleChange(){
+    async handleChange() {
       // 物料赋值'MATERIAL_PARAM'
-      const { referName} = this.$props;
+      const { referName } = this.$props;
 
       let materialCodeList = this.innerValue.split(/,|,|\s+/);
-      
+
       try {
-        let { code, rows } = await REFER( {
-            materialCodeList,
-            type:referName,
-          })
-        if(code == 200){
+        let { code, rows } = await REFER({
+          materialCodeList,
+          type: referName,
+        });
+        if (code == 200) {
           this.$emit("change", rows, this.$props);
         }
-      } catch (error) {
-        
-      }
-      
+      } catch (error) {}
     },
-    handleClear(){
-      this.innerValue = '';
+    handleClear() {
+      this.innerValue = "";
     },
   },
   created() {},
@@ -252,7 +247,7 @@ export default {
   <div class="popover-select-v2">
     <el-input
       v-if="copy"
-      clearable
+      :clearable="clearable"
       v-bind="$attrs"
       v-model="innerValue"
       :size="size"
@@ -264,7 +259,7 @@ export default {
     </el-input>
     <el-autocomplete
       v-else
-      clearable
+      :clearable="clearable"
       v-bind="$attrs"
       v-model="innerValue"
       :value-key="valueKey"
@@ -322,8 +317,12 @@ export default {
               </el-input>
             </el-form-item>
             <el-form-item>
-              <el-button icon="el-icon-search" @click="useQuery">搜索</el-button>
-              <el-button icon="el-icon-refresh" @click="useReset">重置</el-button>
+              <el-button icon="el-icon-search" @click="useQuery"
+                >搜索</el-button
+              >
+              <el-button icon="el-icon-refresh" @click="useReset"
+                >重置</el-button
+              >
             </el-form-item>
           </div>
         </el-form>

+ 45 - 0
src/components/popover-select/components/MANUFACTURER_PARAM.js

@@ -8,4 +8,49 @@ export default [
     item: { key: "name", title: "名称", width: "auto" },
     attr: {},
   },
+  {
+    item: { key: "registrantName", title: "注册人/上市许可持有人", width: "auto" },
+    attr: {
+      type:'ComputedInput',
+      formatter: (prop) => {
+        return prop.manufacturerOther != null ? prop.manufacturerOther.registrantName : null;
+      },
+    },
+  },
+  {
+    item: { key: "productionLicense", title: "生产许可证号/备案凭证号", width: "auto" },
+    attr: {
+      type:'ComputedInput',
+      formatter: (prop) => {
+        return prop.manufacturerOther != null ? prop.manufacturerOther.productionLicense : null;
+      },
+    },
+  },
+  {
+    item: { key: "brand", title: "品牌", width: "auto" },
+    attr: {
+      type:'ComputedInput',
+      formatter: (prop) => {
+        return prop.manufacturerOther != null ? prop.manufacturerOther.brand : null;
+      },
+    },
+  },
+  {
+    item: { key: "countryName", title: "产地", width: "auto" },
+    attr: {
+      type:'ComputedInput',
+      formatter: (prop) => {
+        return prop.manufacturerOther != null ? prop.manufacturerOther.countryName : null;
+      },
+    },
+  },
+  {
+    item: { key: "countryId", title: "产地ID", width: "auto" },
+    attr: {
+      type:'ComputedInput',
+      formatter: (prop) => {
+        return prop.manufacturerOther != null ? prop.manufacturerOther.countryId : null;
+      },
+    },
+  },
 ];

+ 10 - 0
src/components/popover-select/components/MATERIALTAX_PARAM.js

@@ -0,0 +1,10 @@
+export default [
+  {
+    item: { key: "code", title: "编码" , width: "auto"},
+    attr: {},
+  },
+  {
+    item: { key: "name", title: "名称", width: "auto" },
+    attr: {},
+  },
+];

+ 10 - 0
src/components/popover-select/components/ORIGINPLACE_PARAM.js

@@ -0,0 +1,10 @@
+export default [
+  {
+    item: { key: "code", title: "编码" , width: "auto"},
+    attr: {},
+  },
+  {
+    item: { key: "name", title: "名称", width: "auto" },
+    attr: {},
+  },
+];

+ 44 - 23
src/components/popover-tree-select/index.vue

@@ -36,6 +36,19 @@ export default {
       type: Object,
       default: () => ({}),
     },
+    defaultProps: {
+      type: Object,
+      default: () => {
+        return {
+          label: "name",
+          children: "children",
+        };
+      },
+    },
+    onlyFinal: {
+      type: Boolean,
+      default: false,
+    },
   },
   components: {},
   data() {
@@ -48,12 +61,13 @@ export default {
         search: "",
         isPage: false,
       },
+      isSure: true,
       data: [],
       selectData: [],
-      defaultProps: {
-        label: "name",
-        children: "children",
-      },
+      // defaultProps: {
+      //   label: "name",
+      //   children: "children",
+      // },
     };
   },
   computed: {
@@ -140,6 +154,9 @@ export default {
     },
     // select
     useSelect(prop) {
+      if (this.$props.onlyFinal) {
+        this.isSure = prop.children ? false : true;
+      }
       this.selectData = [prop];
     },
     // filter
@@ -149,20 +166,26 @@ export default {
     },
     // confirm
     useConfirm(prop) {
-      this.hide();
-      const {
-        $props: { source, valueKey, dataMapping },
-      } = this;
-      for (let key in dataMapping) {
-        source[key] = prop[0][dataMapping[key]];
+      if (this.isSure) {
+        this.hide();
+        const {
+          $props: { source, valueKey, dataMapping },
+        } = this;
+        for (let key in dataMapping) {
+          source[key] = prop[0][dataMapping[key]];
+        }
+        this.innerValue = prop[0][valueKey];
+        console.log(valueKey, "valueKey");
+        console.log(prop[0][valueKey], "prop[0][valueKey]");
+        console.log(this.innerValue, "innerValue");
+        console.log(source, "source");
+        this.$emit("update:source", source);
+        this.$emit("change", prop, this.$props);
+      } else {
+        this.$message.warning({
+          message: "请选择最末级节点",
+        });
       }
-      this.innerValue = prop[0][valueKey];
-      console.log(valueKey,'valueKey');
-      console.log(prop[0][valueKey],'prop[0][valueKey]');
-      console.log(this.innerValue,'innerValue');
-      console.log(source,'source');
-      this.$emit("update:source", source);
-      this.$emit("change", prop, this.$props);
     },
   },
   created() {},
@@ -212,7 +235,7 @@ export default {
       :close-on-click-modal="false"
       :close-on-press-escape="false"
       append-to-body
-      style="padding: 10px;"
+      style="padding: 10px"
     >
       <div slot="footer">
         <el-button
@@ -225,7 +248,6 @@ export default {
         <el-button :size="$attrs.size" :loading="loading" @click="hide"
           >取 消</el-button
         >
-        
       </div>
       <el-form
         v-loading="loading"
@@ -240,8 +262,8 @@ export default {
         <el-form-item>
           <el-button icon="el-icon-refresh" @click="useReset"></el-button>
         </el-form-item>
-        <div style="height: 400px;overflow: auto;">
-          <el-tree          
+        <div style="height: 400px; overflow: auto">
+          <el-tree
             v-loading="loading"
             :data="data"
             :props="defaultProps"
@@ -257,5 +279,4 @@ export default {
     </el-dialog>
   </div>
 </template>
-<style scoped>
-</style>
+<style scoped></style>

+ 2 - 0
src/components/super-form/index.vue

@@ -102,6 +102,7 @@ export default {
           :label="item.title"
           :required="getFormItemRequired(item, innerValue)"
         >
+        <template #default="form">
           <slot :name="item.key" :row="innerValue" :item="item" :attr="attr">
             <component
               v-if="attr.is === 'el-select'"
@@ -162,6 +163,7 @@ export default {
             >
             </component>
           </slot>
+        </template>
         </el-form-item>
       </el-col>
     </el-row>

+ 6 - 6
src/router/index.js

@@ -138,13 +138,13 @@ export const constantRoutes = [
     component: Layout,
     hidden: true,
     // permissions:['system:material:query'],
-    children: [
-      {
-        path: `detail`,
-        component: () => import('@/views/material/requisition/details')
-      }
+    // children: [
+    //   {
+    //     path: `detail`,
+    //     component: () => import('@/views/material/requisition/details')
+    //   }
 
-    ]
+    // ]
   },
   // 物料基础信息
   {

+ 12 - 2
src/views/material/requisition/add.vue

@@ -55,10 +55,19 @@
             <el-row :gutter="10">
               <el-col :span="6">
                 <el-form-item label="物料名称" prop="name">
-                  <el-input
+                  <el-popover-select-v2
+                    :size="size"
+                    title="物料名称"
+                    v-model="basicForm.name"
+                    :source.sync="basicForm"
+                    valueKey="name"
+                    referName="MATERIAL_PARAM"
+                    style="width: 100%"
+                  ></el-popover-select-v2>
+                  <!-- <el-input
                     :disabled="disable"
                     v-model="basicForm.name"
-                  ></el-input>
+                  ></el-input> -->
                 </el-form-item>
               </el-col>
               <el-col :span="6">
@@ -1270,6 +1279,7 @@ export default {
     "material_enable",
   ],
   components: {
+    ElPopoverSelectV2: () => import("@/components/popover-select-v2/index.vue"),
     factory,
     fourClass,
     unit,

+ 0 - 960
src/views/material/requisition/add/columns.js

@@ -1,960 +0,0 @@
-export default function useColumns(){
-
-  const TableColumns = [
-    {
-      item:{
-        key:'name',
-        title:'物料名称',
-      },
-      attr:{
-        is: "el-input",
-      },
-    },
-    {
-      item:{
-        key:'code',
-        title:'物料名称',
-      },
-      attr:{
-        is: "el-input",
-      },
-    },
-    {
-      item:{
-        key:'',
-        title:'版本号',
-      },
-      attr:{
-        is: "el-input",
-      },
-    },
-    {
-      item:{
-        key:'orgName',
-        title:'所属组织',
-      },
-      attr:{
-        is: "el-popover-select-v2",
-        valueKey: "name",
-        referName: "ORG_PARAM",
-        dataMapping: {
-          orgId:'id'
-        },
-        disabled:true,
-      },
-    },
-    {
-      item:{
-        key:'specification',
-        title:'规格',
-      },
-      attr:{
-        is: "el-input",
-      },
-    },
-    {
-      item:{
-        key:'classifyId',
-        title:'四级分类',
-      },
-      attr:{
-        is: "el-popover-tree-select",
-        referName: "MATERIALCLASSIFY_PARAM",
-        valueKey: "id",
-        dataMapping: {
-          // dosageFrom:'id'
-        }
-      },
-    },
-    {
-      item:{
-        key:'isMedicine',
-        title:'医药物料',
-      },
-      attr:{
-        is: "el-select",
-        dictName: "sys_number_yes_no", // 字典名
-      },
-      
-    },
-    {
-      item:{
-        key:'',
-        title:'同步失败原因',
-      },
-      attr:{
-        is: "el-input",
-      },
-    },
-    {
-      item:{
-        key:'model',
-        title:'型号',
-      },
-      attr:{
-        is: "el-input",
-      },
-  
-    },
-    {
-      item:{
-        key:'packExplain',
-        title:'包装说明',
-      },
-      attr:{
-        is: "el-input",
-      },
-    },
-    {
-      item:{
-        key:'isInventoryStatus',
-        title:'批号及库存状态管理',
-      },
-      attr:{
-        is: "el-select",
-        dictName: "sys_number_yes_no",
-      },
-    },
-    {
-      item:{
-        key:'barCode',
-        title:'条形码',
-      },
-      attr:{
-        is: "el-input",
-      },
-    },
-    {
-      // 单位
-      item:{
-        key:'unitId',
-        title:'计量单位',
-      },
-      attr:{
-        is: "el-popover-select-v2",
-        valueKey: "id",
-        referName: "UNIT_PARAM",
-      },
-    },
-    {
-      item:{
-        key:'deliveryPeriod',
-        title:'交货周期',
-      },
-      attr:{
-        is: "el-input-number",
-      },
-    },
-    {
-      item:{
-        key:'expiryDateManagerment',
-        title:'效期管理',
-      },
-      attr:{
-        is: "el-select",
-        dictName: "sys_number_yes_no",
-      },
-    },
-    {
-      item:{
-        key:'height',
-        title:'高度',
-      },
-      attr:{
-        is: "el-input-number",
-      },
-    },
-    {
-      item:{
-        key:'manufacturerId',
-        title:'生产厂家/代理人',
-      },
-      attr:{
-        is: "el-popover-select-v2",
-        valueKey: "id",
-        referName: "MANUFACTURER_PARAM",
-      },
-    },
-    {
-      item:{
-        key:'minOrderQty',
-        title:'最小起定量',
-      },
-      attr:{
-        is: "el-input-number",
-      },
-    },
-    {
-      item:{
-        key:'expiryUnitId',
-        title:'效期单位',
-      },
-      attr:{
-        is: "el-select",
-        dictName: "period_unit",
-      },
-    },
-    {
-      item:{
-        key:'width',
-        title:'宽度',
-      },
-      attr:{
-        is: "el-input-number",
-      },
-    },
-    { //注册人/上市许可持有人
-      item:{
-        key:'registrant',
-        title:'注册人/上市许可持有人',
-      },
-      attr:{
-        is: "el-input",
-      },
-    },
-    {
-      item:{
-        key:'minPackQty',
-        title:'最小包装量',
-      },
-      attr:{
-        is: "el-input-number",
-      },
-    },
-    {
-      item:{
-        key:'usefulLife',
-        title:'有效期',
-      },
-      attr:{
-        is: "el-input-number",
-      },
-    },
-    {
-      item:{
-        key:'length',
-        title:'长度',
-      },
-      attr:{
-        is: "el-input-number",
-      },
-    },
-    {
-      item:{
-        key:'productionPermit',
-        title:'生产许可证',
-      },
-      attr:{
-        is: "el-input",
-      },
-    },
-    {
-      item:{
-        key:'minBatchQty',
-        title:'最小批量',
-      },
-      attr:{
-        is: "el-input-number",
-      },
-    },
-    {
-      item:{
-        key:'usefulLifeUnitId',
-        title:'有效期至单位',
-      },
-      attr:{
-        is: "el-select",
-      dictName: "expiry_date",
-      },
-    },
-    {
-      item:{
-        key:'oriMaterialCode',
-        title:'原系统物料编码',
-      },
-      attr:{
-        is: "el-input",
-      },
-    },
-    {
-      item:{
-        key:'storageCondition',
-        title:'存储条件',
-      },
-      attr:{
-        is: "el-select",
-        dictName: "sys_storage_condition",
-      },
-    },
-    {
-      item:{
-        key:'diCode',
-        title:'DI码',
-      },
-      attr:{
-        is: "el-input",
-      },
-  
-    },
-    {
-      item:{
-        key:'nearOnsetManagerment',
-        title:'近效期管理',
-      },
-      attr:{
-        is: "el-select",
-        dictName: "sys_number_yes_no",
-      },
-    },
-    {
-      item:{
-        key:'oneClass',
-        title:'一级分类',
-      },
-      attr:{
-        is: "el-input",
-        disabled:true,
-      },
-    },
-    {
-      item:{
-        key:'transportationCondition',
-        title:'运输条件',
-      },
-      attr:{
-        is: "el-select",
-      dictName: "sys_conditions_carriage",
-      },
-    },
-    {
-      item:{
-        key:'healthCode',
-        title:'医保代码',
-      },
-      attr:{
-        is: "el-input",
-      },
-    },
-    {
-      item:{
-        key:'recentWarningPeriod',
-        title:'近效期预警天数',
-      },
-      attr:{
-        is: "el-input-number",
-      },
-    },
-    {
-      item:{
-        key:'twoClass',
-        title:'二级分类',
-      },
-      attr:{
-        is: "el-input",
-        disabled:true,
-      },
-    },
-    {
-      item:{
-        key:'originPlace',
-        title:'产地',
-      },
-      attr:{
-        is: "el-popover-select-v2",
-        valueKey: "name",
-        referName: "ORIGINPLACE_PARAM",
-      },
-    },
-    {
-      item:{
-        key:'manufacturersMaterialName',
-        title:'厂家物料名称',
-      },
-      attr:{
-        is: "el-input",
-      },
-    },
-    {
-      item:{
-        key:'manufacturersMaterialCode',
-        title:'厂家物料编码',
-      },
-      attr:{
-        is: "el-input",
-      },
-    },
-    {
-      item:{
-        key:'threeClass',
-        title:'三级分类',
-      },
-      attr:{
-        is: "el-input",
-        disabled:true,
-      },
-    },
-    {
-      item:{
-        key:'serviceLife',
-        title:'使用期限/次数',
-      },
-      attr:{
-        is: "el-input",
-      },
-    },
-    {
-      item:{
-        key:'materialRate',
-        title:'物料税类',
-      },
-      attr:{
-        is: "el-popover-select-v2",
-        valueKey: "name",
-        referName: "MATERIALTAX_PARAM",
-        dataMapping: {
-          rateCode: "code",
-        },
-      },
-    },
-    {
-      item:{
-        key:'isEnable',
-        title:'启用状态',
-      },
-      attr:{
-        is: "el-select",
-        dictName: "material_enable",
-        disabled:true,
-      },
-    },
-    {
-      item:{
-        key:'',
-        title:'品牌',
-      },
-      attr:{
-        is: "el-input",
-        disabled:true,
-      },
-    },
-    {
-      item:{
-        key:'purchasingOrganization',
-        title:'默认采购组织',
-      },
-      attr:{
-        is: "el-popover-select-v2",
-        valueKey: "name",
-        referName: "ORG_PARAM",
-        // dataMapping: {
-        //   orgId:'id'
-        // },
-      },
-    },
-    {
-      item:{
-        key:'serviceClass',
-        title:'服务类',
-      },
-      attr:{
-        is: "el-input-number",
-        disabled:true,
-      },
-    },
-    {
-      item:{
-        key:'remark',
-        title:'备注',
-      },
-      attr:{
-        is: "el-input",
-      },
-    },
-    {
-      item:{
-        key:'serialNoManager',
-        title:'序列号管理',
-      },
-      attr:{
-        is: "el-select",
-        dictName: "sys_number_yes_no",
-      },
-    },
-    {
-      item:{
-        key:'puPersonnelId',
-        title:'采购员',
-      },
-      attr:{
-        is: "el-popover-select-v2",
-        referName: "CONTACTS_PARAM",
-        valueKey: "name",
-        // dataMapping: {
-        //   puPersonnelId: "code",
-        // },
-      },
-    },
-    {
-      item:{
-        key:'proposerId',
-        title:'物料申请人',
-      },
-      attr:{
-        is: "el-input",
-      },
-    },
-
-
-
-
-
-
-    // {
-    //   item:{
-    //     key:'billCode',
-    //     title:'单据编码',
-    //   },
-    //   attr:{
-    //     is: "el-input",
-    //     disabled:true,
-    //   },
-    // },
-    // {
-    //   item:{
-    //     key:'enName',
-    //     title:'英文名称',
-    //   },
-    //   attr:{
-    //     is: "el-input",
-    //   },
-  
-    // },
-    // {
-    //   item:{
-    //     key:'commonName',
-    //     title:'简称',
-    //   },
-    //   attr:{
-    //     is: "el-input",
-    //   },
-  
-    // },
-    // {
-    //   item:{
-    //     key:'unitId',
-    //     title:'计量单位',
-    //   },
-    //   attr:{
-    //     is: "el-popover-select-v2",
-    //     valueKey: "id",
-    //     referName: "UNIT_PARAM",
-    //   },
-  
-    // },
-    // {
-    //   item:{
-    //     key:'classifyAbc',
-    //     title:'ABC分类',
-    //   },
-    //   attr:{
-    //     is: "el-select",
-    //   dictName: "abc_type",
-    //   },
-  
-    // },
-    // {
-    //   item:{
-    //     key:'safeStock',
-    //     title:'安全库存',
-    //   },
-    //   attr:{
-    //     is: "el-input-number",
-    //   },
-  
-    // },
-    // {
-    //   item:{
-    //     key:'isB2c',
-    //     title:'B2C物料',
-    //   },
-    //   attr:{
-    //     is: "el-select",
-    //     dictName: "sys_number_yes_no",
-    //   },
-  
-    // },
-    // {
-    //   item:{
-    //     key:'assembly',
-    //     title:'成套件',
-    //   },
-    //   attr:{
-    //     is: "el-select",
-    //     dictName: "sys_number_yes_no",
-    //   },
-  
-    // },
-    // {
-    //   item:{
-    //     key:'mediumPackageUnitId',
-    //     title:'中包装单位',
-    //   },
-    //   attr:{
-    //     is: "el-popover-select-v2",
-    //     valueKey: "id",
-    //     referName: "UNIT_PARAM",
-    //   },
-  
-    // },
-    // {
-    //   item:{
-    //     key:'rateCode',
-    //     title:'物料税类编码',
-    //   },
-    //   attr:{
-    //     is: "el-input",
-    //     disabled:true,
-    //   },
-  
-    // },
-    // {
-    //   item:{
-    //     key:'height',
-    //     title:'高度(MM)',
-    //   },
-    //   attr:{
-    //     is: "el-input-number",
-    //   },
-  
-    // },
-    // {
-    //   item:{
-    //     key:'boxPackaingQty',
-    //     title:'箱包装数',
-    //   },
-    //   attr:{
-    //     is: "el-input-number",
-    //   },
-  
-    // },
-    // {
-    //   item:{
-    //     key:'mediumPackageQty',
-    //     title:'中包装数',
-    //   },
-    //   attr:{
-    //     is: "el-input-number",
-    //   },
-  
-    // },
-    
-    // // {
-    // //   item:{
-    // //     key:'businessLine',
-    // //     title:'业务线',
-    // //   },
-    // //   attr:{
-    // //     is: "el-input",
-    // //   },
-    // // },
-    
-    // // {
-    // //   item:{
-    // //     key:'businessDepartment',
-    // //     title:'业务部门',
-    // //   },
-    // //   attr:{
-    // //     is: "el-input",
-    // //     disabled:true,
-    // //   },
-  
-    // // },
-   
-    // {
-    //   item:{
-    //     key:'importsManufacturer',
-    //     title:'进口产品生产厂家',
-    //   },
-    //   attr:{
-    //     is: "el-input",
-    //   },
-  
-    // },
-    
-    // {
-    //   item:{
-    //     key:'innerPackingUnit',
-    //     title:'内包装单位',
-    //   },
-    //   attr:{
-    //     is: "el-popover-select-v2",
-    //     valueKey: "id",
-    //     referName: "UNIT_PARAM",
-    //   },
-  
-    // },
-    // {
-    //   item:{
-    //     key:'innerPackingQty',
-    //     title:'内包装数',
-    //   },
-    //   attr:{
-    //     is: "el-input",
-    //   },
-  
-    // },
-    
-    // {
-    //   item:{
-    //     key:'isDrug',
-    //     title:'药品',
-    //   },
-    //   attr:{
-    //     is: "el-select",
-    //     dictName: "sys_medicine", // 字典名
-    //   },
-  
-    // },
-    // {
-    //   item:{
-    //     key:'registrationNo',
-    //     title:'注册证号/备案凭证编号',
-    //   },
-    //   attr:{
-    //     is: "el-input",
-    //   },
-  
-    // },
-    // {
-    //   item:{
-    //     key:'medicalInstruments',
-    //     title:'医疗器械',
-    //   },
-    //   attr:{
-    //     is: "el-select",
-    //     dictName: "medical_instruments", // 字典名
-    //   },
-  
-    // },
-    // {
-    //   item:{
-    //     key:'commonName',
-    //     title:'通用名称',
-    //   },
-    //   attr:{
-    //     is: "el-input",
-    //   },
-  
-    // },
-    // {
-    //   item:{
-    //     key:'ratifyBatchNo',
-    //     title:'批准文号',
-    //   },
-    //   attr:{
-    //     is: "el-input",
-    //   },
-  
-    // },
-    // {
-    //   item:{
-    //     key:'dosageFrom',
-    //     title:'剂型',
-    //   },
-    //   attr:{
-    //     is: "el-popover-tree-select",
-    //     referName: "DOSAGEFORM_PARAM",
-    //     valueKey: "name",
-    //     // dataMapping: {
-    //     //   dosageFrom:'id'
-    //     // }
-    //   },
-  
-    // },
-    // {
-    //   item:{
-    //     key:'oriRegistrationNo',
-    //     title:'旧注册证号',
-    //   },
-    //   attr:{
-    //     is: "el-input",
-    //   },
-  
-    // },
-    // {
-    //   item:{
-    //     key:'curingType',
-    //     title:'养护类型',
-    //   },
-    //   attr:{
-    //     is: "el-select",
-    //     dictName: "curing_type", // 字典名
-    //   },
-  
-    // },
-    // {
-    //   item:{
-    //     key:'createName',
-    //     title:'申请人',
-    //   },
-    //   attr:{
-    //     is: "el-input",
-    //     disabled:true,
-    //   },
-  
-    // },
-    // {
-    //   item:{
-    //     key:'createTime',
-    //     title:'申请时间',
-    //   },
-    //   attr:{
-    //     is: "el-date-picker",
-    //     valueFormat: "yyyy-MM-dd HH:mm:ss",
-    //     disabled:true,
-    //   },
-  
-    // },
-    // {
-    //   item:{
-    //     key:'createName',
-    //     title:'创建人',
-    //   },
-    //   attr:{
-    //     is: "el-input",
-    //     disabled:true,
-    //   },
-  
-    // },
-    // {
-    //   item:{
-    //     key:'createTime',
-    //     title:'创建时间',
-    //   },
-    //   attr:{
-    //     is: "el-date-picker",
-    //     valueFormat: "yyyy-MM-dd HH:mm:ss",
-    //     disabled:true,
-    //   },
-  
-    // },
-    // {
-    //   item:{
-    //     key:'updateName',
-    //     title:'最后修改人',
-    //   },
-    //   attr:{
-    //     is: "el-input",
-    //     disabled:true,
-    //   },
-  
-    // },
-    // {
-    //   item:{
-    //     key:'updateTime',
-    //     title:'最后修改时间',
-    //   },
-    //   attr:{
-    //     is: "el-date-picker",
-    //     valueFormat: "yyyy-MM-dd HH:mm:ss",
-    //     disabled:true,
-    //   },
-  
-    // },
-    // // {
-    // //   item:{
-    // //     key:'reviewedByName',
-    // //     title:'最后审核人',
-    // //   },
-    // //   attr:{
-    // //     is: "el-input",
-    // //     disabled:true,
-    // //   },
-  
-    // // },
-    // // {
-    // //   item:{
-    // //     key:'approvalTime',
-    // //     title:'最后审核时间',
-    // //   },
-    // //   attr:{
-    // //     is: "el-date-picker",
-    // //     valueFormat: "yyyy-MM-dd HH:mm:ss",
-    // //     disabled:true,
-    // //   },
-  
-    // // },
-    // {
-    //   item:{
-    //     key:'status',
-    //     title:'单据状态',
-    //   },
-    //   attr:{
-    //     is: "el-select",
-    //     dictName: "documents_status", // 字典名
-    //     disabled:true,
-    //   },
-  
-    // },
-    
-    
-  ].map(({ item, attr }) => ({
-    attr,
-    item: { ...item, hidden: true, span: item.span || 6 },
-  }));
-  
-  const TabColumns = [
-    {
-      item:{
-        key:'maintainMaterialType',
-        title:'维护物料类别',
-      },
-      attr:{
-        value:[]
-      },
-      TableColumns:[
-        {
-          item:{
-            key:'drugId',
-            title:'ID',
-          },
-          attr:{
-            is: "el-select",
-            dictName: "sys_number_yes_no", // 字典名
-          },
-         
-        },
-        {
-          item:{
-            key:'drugCode',
-            title:'药品类别编码',
-            require: true,
-          },
-          attr:{
-            is: "el-popover-select-v2",
-            valueKey: "code",
-          },
-         
-        },
-        {
-          item:{
-            key:'drugName',
-            title:'药品类别名称',
-            require: true,
-          },
-          attr:{
-            is: "el-input",
-            // disabled:true,
-          },
-         
-        },
-        
-      
-  
-      ]
-    }, 
-  ]
-
-  return {TableColumns,TabColumns}
-}
-

+ 0 - 336
src/views/material/requisition/add/index.vue

@@ -1,336 +0,0 @@
-<script>
-export default {
-  name:'AddRequsition',
-  props: {
-    dict: {
-      type: Object,
-    },
-    addType: {
-      type: String,
-      default: "add",
-    },
-  },
-  components:{
-    ElSuperForm: () => import("@/components/super-form/index.vue"),
-    ElSuperTable: () => import("@/components/super-table/index.vue"),
-    ElPopoverSelectV2: () => import("@/components/popover-select-v2/index.vue"),
-    ElPopoverTreeSelect: () =>
-      import("@/components/popover-tree-select/index.vue"),
-  
-  },
-  data(){
-    const {
-      TabColumns,
-      TableColumns,
-      TabColumns: [
-        {
-          item: { key: tabName },
-        },
-      ],
-    } = useColumns();
-
-    const rules = this.$init.rules([...TabColumns, ...TableColumns]);
-    const params = this.$init.params([...TabColumns, ...TableColumns]);
-    return{
-      width: "100%",
-      visible: false,
-      loading:false,
-      rules,
-      params,
-      tabName: tabName,
-      TabColumns: TabColumns,
-      TableColumns: TableColumns,
-    } 
-  },
-  computed: {
-    title: {
-      get() {
-        const { addType } = this;
-        if (addType === "add") {
-          return "新 增";
-        }
-        if (addType === "edit") {
-          return "编 辑";
-        }
-      },
-      set() {},
-    },
-    materialInfo:{
-      get(){
-        const { materialBasic } = this.params;
-        this.params.materialBasic = materialBasic.map((item, index) => ({
-          ...item,
-          $index: index,
-        }));
-
-        return {
-          materialBasic: this.params.materialBasic.filter(
-            ({ delFlag }) => delFlag !== "2"
-          ),
-        }
-      },
-      set(){},
-    }
-  },
-  methods: {
-    setVisible(prop){
-      this.visible = prop;
-    },
-    beforeOpen(){
-      if(this.addType === 'add'){
-        let {name,nickName} = this.$store.state.user;
-        this.params.createBy = name;
-        this.params.createByName = nickName;
-        this.params.createTime =  new Date().Format('yyyy-MM-dd HH:mm:ss');
-        this.params.updateBy = name;
-        this.params.updateByName = nickName;
-        this.params.updateTime =  new Date().Format('yyyy-MM-dd HH:mm:ss');
-        // this.params.approver = name;
-        this.params.applicationTime =  new Date().Format('yyyy-MM-dd HH:mm:ss');
-        this.params.status = '0';
-        console.log(this.$store.state.user,'user');
-        this.params.orgName = '德荣集团';
-        this.useRowAdd(this.tabName);
-      }
-    },
-
-    //
-    async fetchItem(prop) {
-      console.log(prop,'prop----------------');
-      try {
-        // try
-        this.loading = true;
-
-        let { code, data } = await getChangeDetails(prop.id);
-
-        if(code == 200){
-          this.params = data;
-        }
-        
-      } catch (err) {
-        // catch
-        console.error(err);
-      } finally {
-        // finally
-        this.loading = false;
-      }
-    },
-    
-    //
-    async hide() {
-      const {
-        TabColumns,
-        TableColumns,
-        TabColumns: [
-          {
-            item: { key: tabName },
-          },
-        ],
-      } = useColumns();
-      this.visible = false;
-      this.$emit('success');
-      this.tabName = tabName;
-      this.params = this.$init.params([...TabColumns, ...TableColumns]);
-    },
-    //
-    async useRowAdd(prop) {
-      
-      const { TableColumns } = this.TabColumns.find(
-        ({ item: { key } }) => key === prop
-      );
-      this.params[prop].push({
-        delFlag: "0",
-        materialClassifyId:null,
-        ...this.$init.params(TableColumns),
-      });
-    },
-    //
-    async useRowRemove(prop, scope) {
-      const { addType } = this.$props;
-      const {
-        row: { $index },
-      } = scope;
-      if (addType === "add") {
-        this.params[prop].splice($index, 1);
-      }
-      if (addType === "edit") {
-        this.params[prop] = this.params[prop].map((item, index) => ({
-          ...item,
-          delFlag: index === $index ? "2" : item.delFlag,
-        })).filter(item =>( item.id  || (!item.id && item.delFlag === '0')) )
-        ;
-      }
-    },
-    handleSubmitValidate(prop,cb){
-
-      this.$refs[prop].$refs[prop].validate(async (valid) => {
-        if (valid) {
-          try {
-            this.loading = true;
-
-            let validList = this.params['materialBasic'].filter(item => item.delFlag === '0');
-
-            if(validList.length){
-              await cb();
-            }else{
-              this.$notify.error({
-                message:'物料信息不能不为空!'
-              })
-            }
-            
-          } catch (err) {
-            // catch
-            console.error(err);
-          } finally {
-            // finally
-            this.loading = false;
-          }
-        } else {
-          return false;
-        }
-      });
-    },
-    //
-    async useSubmit(prop) {
-      console.log(this.params,'this.params');
-      this.handleSubmitValidate(prop,async()=>{
-
-        try {
-          this.loading = true;
-          const {code,msg} = await addChangeList(this.params);
-
-          if(code == 200){
-
-            this.hide();
-            this.$notify.success({
-              title: msg,
-            });
-          }
-          
-        } catch (error) {}
-        finally{
-          this.loading = false;
-        }
-
-        
-        // await;
-      })
-    },
-  },
-  created() {
-  },
-  mounted() {},
-  destroyed() {},
-}
-</script>
-
-<template>
- <el-drawer
-      v-bind="$attrs"
-      v-on="$listeners"
-      :size="width"
-      :visible.sync="visible"
-      destroy-on-close
-      :show-close="false"
-      @close="hide"
-      @open="beforeOpen"
-      v-loading="loading"
-    >
-      <div 
-        slot="title" 
-        style="display: flex;
-            justify-content: space-between;
-            align-items: center;"
-      >
-        <h3>{{title}}</h3>
-        <div>
-          <el-button
-          type="primary"
-          :size="$attrs.size"
-          :loading="loading"
-          @click="useSubmit('superForm')"
-          >确 认</el-button
-        >
-        <el-button :size="$attrs.size" :loading="loading" @click="hide"
-          >取 消</el-button
-        >
-        </div>
-      </div>
-      <el-super-form
-        v-model="params"
-        :dict="dict"
-        :rules="rules"
-        :size="$attrs.size"
-        :columns="TableColumns"
-        ref="superForm"
-        label-width="auto"
-        label-position="right"
-        style="padding: 20px"
-      >
-        <!-- <template slot="puOrgName" slot-scope="scope">
-          <component
-            v-bind="scope.attr"
-            v-model="scope.row[scope.item.key]"
-            :size="$attrs.size"
-            :source.sync="scope.row"
-          >
-          </component
-        ></template> -->
-      </el-super-form>
-      
-  
-      <el-tabs v-model="tabName" style="padding: 0 20px 20px">
-        <el-tab-pane
-          v-for="({ item, TableColumns: columns }, index) in TabColumns"
-          :key="index"
-          :label="item.title"
-          :name="item.key"
-          lazy
-        >
-          <div style="height: 420px;display:flex">
-            <el-super-table
-              v-model="materialInfo[item.key]"
-              :dict="dict"
-              :ref="tabName"
-              :columns="columns"
-              :size="$attrs.size"
-            >
-              <el-table-column fixed="right" label="操作" width="120" align="center">
-                <template slot="header" slot-scope="scope">
-                  <el-button
-                    type="text"
-                    :size="$attrs.size"
-                    @click="useRowAdd(tabName)"
-                  >
-                    增行
-                  </el-button>
-                </template>
-                <template slot-scope="scope">
-                  <el-button
-                    type="text"
-                    :size="$attrs.size"
-                    @click.native.prevent="useRowRemove(tabName, scope)"
-                  >
-                  删除
-                  </el-button>
-                  <AmendantRecord
-                    v-if=" tabName ==='materialBasic' && addType === 'edit' && scope.row.id"
-                    v-model="scope.row"
-                  ></AmendantRecord>
-                </template>
-              </el-table-column>
-            </el-super-table>
-          </div>
-        </el-tab-pane>
-      </el-tabs>
-
-      
-     
-    </el-drawer>
-</template>
-
-<style scoped>
-::v-deep .el-table__row.is-hidden {
-  display: none;
-}
-</style>

+ 11 - 5
src/views/material/requisition/columns.js

@@ -1,15 +1,16 @@
 
+export default function useColumns (){
 
- export const TableColumns = [
-  { item: { key: "createName", title: "创建人" ,width:150, }, attr: {} },
+  const TableColumns = [
+  { item: { key: "createName", title: "创建人" ,width:100, }, attr: {} },
   { item: { key: "createTime", title: "创建时间" ,width:150,}, attr: {} },
   { item: { key: "billCode", title: "单据编码" }, attr: {} },
   
   {
-    item: { key: "proposerName", title: "申请人",width:150, },
+    item: { key: "proposerName", title: "申请人",width:100, },
     attr: { },
   },
-  { item: { key: "status", title: "单据状态",width:120, }, 
+  { item: { key: "status", title: "单据状态",width:100, }, 
       attr: {
         
         is: "el-dict-tag",
@@ -58,7 +59,7 @@
     item: { ...item, hidden: true, fixed: false },
   }));
 
- export const SearchColumns = [
+  const SearchColumns = [
     {
       item: { key: "billCode", title: "单据编码" },
       attr: {
@@ -222,3 +223,8 @@
     item: { ...item, hidden: true, span: item.span || 6 },
   }));
 
+  return { TableColumns,SearchColumns }
+
+}
+
+

+ 0 - 82
src/views/material/requisition/details.vue

@@ -1,82 +0,0 @@
-<!-- 物料申请单——详情 -->
-<template>
-  <el-card class="request-details">
-    1111111111
-
-    <el-row type="flex" justify="space-between">
-      <el-col :span="6">
-        <el-button size="small" @click="handleBack">返回</el-button>
-      </el-col>
-      <el-col :span="6" style="text-align: right;">
-        <!-- 附件管理 -->
-        <el-button-group>
-          <el-button size="small" icon="el-icon-paperclip"></el-button>
-        </el-button-group>
-
-        <!-- 切换 -->
-        <el-button-group>
-          <el-button size="small" icon="el-icon-d-arrow-left"></el-button>
-          <el-button size="small" icon="el-icon-arrow-left"></el-button>
-          <el-button size="small" icon="el-icon-arrow-right"></el-button>
-          <el-button size="small" icon="el-icon-d-arrow-right"></el-button>
-        </el-button-group>
-      </el-col>
-    </el-row>
-
-    <div class="rd-content">
-
-      <dr-tabs :tabList="detailsTabs">
-        <template #tabContent>11111</template>
-      </dr-tabs>
-
-    </div>
-  </el-card>
-</template>
-
-<script>
-import drTabs from '../components/dr-tabs.vue';
-// import detailsTabs from '../config/detailsTabs';
-export default {
-  name: 'material-details',
-  data() {
-    return {
-
-      detailsTabs: [
-        {
-          label: '基本信息',
-          code: 'material',
-          isShow: true,
-        },
-        {
-          label: '医药行业',
-          code: 'material_medcine',
-          isShow: true,
-        },
-      ]
-    }
-  },
-  components: {
-    drTabs
-
-  },
-  methods: {
-    // 返回
-    handleBack() {
-      this.$emit("actionBar", "requestList")
-
-    }
-  }
-
-}
-</script>
-
-<style lang="scss">
-.request-details {
-  height: calc(100vh - 158px);
-  box-sizing: border-box;
-
-  .rd-content {
-    margin-top: 12px;
-  }
-}
-</style>

+ 951 - 0
src/views/material/requisition/details/columns.js

@@ -0,0 +1,951 @@
+
+export default function useColumns(){
+
+ 
+  const TabColumns = [
+    // 基本信息
+    {
+      item:{
+        key: 'sysMaterialApply',
+        title: '基本信息',
+      },
+      attr:{
+        is: 'el-super-form',
+        
+        value:{},
+      },
+      TableColumns:[
+        {
+          item:{
+            key:'name',
+            title:'物料名称',
+            required:true,
+          },
+          attr:{
+            is: "el-input",
+            // is: "el-popover-select-v2",
+            // valueKey: "name",
+            // referName: "MATERIAL_PARAM",
+            // dataMapping: {
+            //   classifyId: 'classifyId',
+            //   classifyName: 'classifyIdName',
+            //   isMedicine: 'isMedicine',
+            //   unitId: 'unitId',
+            //   unitName: 'unitIdName',
+            //   packExplain: 'packExplain',
+            //   isInventoryStatus: 'isInventoryStatus',
+            //   manufacturerId: 'manufacturerId',
+            //   manufacturerName: 'manufacturerIdName',
+            //   deliveryPeriod: 'deliveryPeriod',
+            //   expiryDateManagerment: 'expiryDateManagerment',
+            //   registrant: 'registrant',
+            //   minOrderQty: 'minOrderQty',
+            //   expiryUnitId: 'expiryUnitId',
+            //   productionPermit: 'productionPermit',
+            //   minPackQty: 'minPackQty',
+            //   usefulLife: 'usefulLife',
+            //   storageCondition: 'storageCondition',
+            //   minBatchQty: 'minBatchQty',
+            //   usefulLifeUnitId: 'usefulLifeUnitId',
+            //   transportationCondition: 'transportationCondition',
+            //   materialRate: 'materialRate',
+            //   materialRateName: 'materialRateName',
+            //   nearOnsetManagerment: 'nearOnsetManagerment',
+            //   originPlace: 'originPlace',
+            //   originPlaceName: 'originPlaceName',
+            //   purchasingOrganization: 'purchasingOrganization',
+            //   purchasingOrganizationName: 'purchasingOrganizationName',
+            //   recentWarningPeriod: 'recentWarningPeriod',
+            //   brand:'brand',
+            //   puPersonnelId:'puPersonnelId',
+            //   puPersonnelName:'puPersonnelIdName',
+            // },
+          },
+        },
+        {
+          item:{
+            key:'code',
+            title:'物料编码',
+          },
+          attr:{
+            is: "el-input",
+            disabled: true,
+          },
+        },
+        {
+          item:{
+            key:'version',
+            title:'版本号',
+          },
+          attr:{
+            is: "el-input",
+            disabled: true,
+          },
+        },
+        {
+          item:{
+            key:'orgName',
+            title:'所属组织',
+          },
+          attr:{
+            is: "el-popover-select-v2",
+            valueKey: "name",
+            referName: "ORG_PARAM",
+            dataMapping: {
+              orgId:'id'
+            },
+            disabled:true,
+          },
+        },
+        {
+          item:{
+            key:'specification',
+            title:'规格',
+            required: true,
+          },
+          attr:{
+            is: "el-input",
+          },
+        },
+        {
+          item:{
+            // key:'classifyId',
+            key:'classifyName',
+            title:'四级分类',
+            required: true,
+          },
+          attr:{
+            is: "el-popover-tree-select",
+            referName: "MATERIALCLASSIFY_PARAM",
+            valueKey: "name",
+            // 末级
+            onlyFinal: true,
+            defaultProps: {
+              label: function (data, node) {
+                return data.code + " " + data.name;
+              },
+              children: "children",
+            },
+            dataMapping: {
+              classifyId:'id'
+            }
+          },
+        },
+        {
+          item:{
+            key:'isMedicine',
+            title:'医药物料',
+          },
+          attr:{
+            is: "el-select",
+            dictName: "sys_number_yes_no", // 字典名
+          },
+          
+        },
+        {
+          item:{
+            key:'failCause',
+            title:'同步失败原因',
+          },
+          attr:{
+            is: "el-input",
+          },
+        },
+        {
+          item:{
+            key:'model',
+            title:'型号',
+          },
+          attr:{
+            is: "el-input",
+          },
+      
+        },
+        {
+          item:{
+            key:'packExplain',
+            title:'包装说明',
+            required: true,
+          },
+          attr:{
+            is: "el-input",
+          },
+        },
+        {
+          item:{
+            key:'serialNoManager',
+            title:'序列号管理',
+          },
+          attr:{
+            is: "el-select",
+            dictName: "sys_number_yes_no",
+          },
+        },
+        {
+          item:{
+            key:'barCode',
+            title:'条形码',
+          },
+          attr:{
+            is: "el-input",
+          },
+        },
+        {
+          // 单位
+          item:{
+            key:'unitName',
+            title:'计量单位',
+            required: true,
+          },
+          attr:{
+            is: "el-popover-select-v2",
+            valueKey: "name",
+            referName: "UNIT_PARAM",
+            dataMapping: {
+              unitId:'id'
+            }
+          },
+        },
+        {
+          item:{
+            key:'deliveryPeriod',
+            title:'交货周期',
+            required: true,
+          },
+          attr:{
+            is: "el-input-number",
+            min: 0,
+            controlsPosition: "right",
+          },
+        },
+        {
+          item:{
+            key:'isInventoryStatus',
+            title:'批号及库存状态管理',
+          },
+          attr:{
+            is: "el-select",
+            dictName: "sys_number_yes_no",
+          },
+        },
+        {
+          item:{
+            key:'height',
+            title:'高度',
+          },
+          attr:{
+            is: "el-input-number",
+            min: 0,
+            controlsPosition: "right",
+            
+          },
+        },
+        {
+          item:{
+            key:'manufacturerName',
+            title:'生产厂家/代理人',
+            required: true,
+          },
+          attr:{
+            is: "el-popover-select-v2",
+            valueKey: "name",
+            referName: "MANUFACTURER_PARAM",
+            dataMapping: {
+              manufacturerId: 'id',
+              brand:"brand" ,
+              originPlaceName: "countryName" ,
+              originPlace: "countryId",
+              registrant: "registrantName" ,
+              productionPermit: "productionLicense",
+            }
+          },
+        },
+        {
+          item:{
+            key:'minOrderQty',
+            title:'最小起订量',
+            required: true,
+          },
+          attr:{
+            is: "el-input-number",
+            min: 0,
+            controlsPosition: "right",
+          },
+        },
+        {
+          item:{
+            key:'expiryDateManagerment',
+            title:'效期管理',
+          },
+          attr:{
+            is: "el-select",
+            dictName: "sys_number_yes_no",
+          },
+        },
+        {
+          item:{
+            key:'width',
+            title:'宽度',
+          },
+          attr:{
+            is: "el-input-number",
+            min: 0,
+            controlsPosition: "right",
+          },
+        },
+        { 
+          item:{
+            key:'registrant',
+            title:'注册人/上市许可持有人',
+            required: true,
+          },
+          attr:{
+            is: "el-input",
+          },
+        },
+        {
+          item:{
+            key:'minPackQty',
+            title:'最小包装量',
+            required: true,
+          },
+          attr:{
+            is: "el-input-number",
+            min: 0,
+            controlsPosition: "right",
+          },
+        },
+        {
+          item:{
+            key:'expiryUnitId',
+            title:'效期单位',
+          },
+          attr:{
+            is: "el-select",
+            dictName: "period_unit",
+          },
+        },
+        {
+          item:{
+            key:'length',
+            title:'长度',
+          },
+          attr:{
+            is: "el-input-number",
+            min: 0,
+            controlsPosition: "right",
+          },
+        },
+        {
+          item:{
+            key:'productionPermit',
+            title:'生产许可证',
+          },
+          attr:{
+            is: "el-input",
+          },
+        },
+        {
+          item:{
+            key:'minBatchQty',
+            title:'最小批量',
+            required: true,
+          },
+          attr:{
+            is: "el-input-number",
+            min: 0,
+            controlsPosition: "right",
+          },
+        },
+        {
+          item:{
+            key:'usefulLife',
+            title:'有效期',
+          },
+          attr:{
+            is: "el-input-number",
+            min: 0,
+            controlsPosition: "right",
+          },
+        },
+        {
+          item:{
+            key:'oneClass',
+            title:'一级分类',
+          },
+          attr:{
+            is: "el-input",
+            disabled: true,
+          },
+        },
+        {
+          item:{
+            key:'storageCondition',
+            title:'存储条件',
+            required: true,
+          },
+          attr:{
+            is: "el-select",
+            dictName: "sys_storage_condition",
+          },
+        },
+        {
+          item:{
+            key:'diCode',
+            title:'DI码',
+          },
+          attr:{
+            is: "el-input",
+          },
+      
+        },
+        {
+          item:{
+            key:'usefulLifeUnitId',
+            title:'有效期至单位',
+          },
+          attr:{
+            is: "el-select",
+          dictName: "expiry_date",
+          },
+        },
+        {
+          item:{
+            key:'twoClass',
+            title:'二级分类',
+          },
+          attr:{
+            is: "el-input",
+            disabled: true,
+          },
+        },
+        {
+          item:{
+            key:'transportationCondition',
+            title:'运输条件',
+          },
+          attr:{
+            is: "el-select",
+          dictName: "sys_conditions_carriage",
+          },
+        },
+        {
+          item:{
+            key:'healthCode',
+            title:'医保代码',
+          },
+          attr:{
+            is: "el-input",
+          },
+        },
+        {
+          item:{
+            key:'nearOnsetManagerment',
+            title:'近效期管理',
+          },
+          attr:{
+            is: "el-select",
+            dictName: "sys_number_yes_no",
+          },
+        },
+        {
+          item:{
+            key:'threeClass',
+            title:'三级分类',
+          },
+          attr:{
+            is: "el-input",
+            disabled: true,
+          },
+        },
+        {
+          item:{
+            key:'originPlaceName',
+            title:'产地',
+            required: true,
+          },
+          attr:{
+            is: "el-popover-select-v2",
+            valueKey: "name",
+            referName: "ORIGINPLACE_PARAM",
+            dataMapping: {
+              originPlace: 'id'
+            },
+            disabled: true,
+          },
+          
+        },
+        {
+          item:{
+            key:'manufacturersMaterialCode',
+            title:'厂家物料编码',
+          },
+          attr:{
+            is: "el-input",
+          },
+        },
+        {
+          item:{
+            key:'recentWarningPeriod',
+            title:'近效期预警天数',
+          },
+          attr:{
+            is: "el-input-number",
+            min: 0,
+            controlsPosition: "right",
+          },
+        },
+        {
+          item:{
+            key:'isEnable',
+            title:'启用状态',
+          },
+          attr:{
+            is: "el-select",
+            dictName: "material_enable",
+            disabled: true,
+          },
+        },
+        {
+          item:{
+            key:'serviceLife',
+            title:'使用期限/次数',
+          },
+          attr:{
+            is: "el-input",
+          },
+        },
+        {
+          item:{
+            key:'purchasingOrganizationName',
+            title:'默认采购组织',
+            required: true,
+          },
+          attr:{
+            is: "el-popover-select-v2",
+            valueKey: "name",
+            referName: "ORG_PARAM",
+            dataMapping: {
+              purchasingOrganization:'id'
+            },
+          },
+        },
+        {
+          item:{
+            key:'materialRateName',
+            title:'物料税类',
+            required: true,
+          },
+          attr:{
+            is: "el-popover-select-v2",
+            valueKey: "name",
+            referName: "MATERIALTAX_PARAM",
+            dataMapping: {
+              materialRate: "code",
+            },
+          },
+        },
+        {
+          item:{
+            key:'remark',
+            title:'备注',
+          },
+          attr:{
+            is: "el-input",
+          },
+        },
+        {
+          item:{
+            key:'brand',
+            title:'品牌',
+          },
+          attr:{
+            is: "el-input",
+            disabled: true,
+          },
+        },
+        {
+          item:{
+            key:'puPersonnelName',
+            title:'负责采购员',
+            required: true,
+          },
+          attr:{
+            is: "el-popover-select-v2",
+            referName: "CONTACTS_PARAM",
+            valueKey: "name",
+            dataMapping: {
+              puPersonnelId: "code",
+            },
+          },
+        },
+        {
+          item:{
+            key:'proposerName',
+            title:'物料申请人',
+          },
+          attr:{
+            // is: "el-input",
+            // PSNLICENSE_PARAM
+            disabled: true,
+            is: "el-popover-select-v2",
+            referName: "CONTACTS_PARAM",
+            valueKey: "name",
+            dataMapping:{
+              proposerId: 'code'
+            }
+          },
+        },
+        {
+          item:{
+            key:'serviceClass',
+            title:'服务类',
+          },
+          attr:{
+            is: "el-input",
+            // min: 0,
+            // controlsPosition: "right",
+            disabled: true,
+          },
+        },
+
+      ].map(({ item, attr }) => ({
+        attr,
+        item: { ...item, hidden: true, span: item.span || 6 },
+      })),
+    },
+    // 医药属性
+    {
+      item:{
+        key:'sysMaterialMedcineApply',
+        title:'医药属性',
+      },
+      attr:{
+        is: 'el-super-form',
+        value:{},
+      },
+      TableColumns:[
+        {
+          item:{
+            key:'isDrug',
+            title:'药品',
+          },
+          attr:{
+            is: "el-select",
+            dictName: "sys_medicine", // 字典名
+          },
+      
+        },
+        {
+          item:{
+            key:'registrationNo',
+            title:'注册证号/备案凭证编号',
+          },
+          attr:{
+            is: "el-input",
+          },
+      
+        },
+        {
+          item:{
+            key:'medicalInstruments',
+            title:'管理类别',
+          },
+          attr:{
+            is: "el-select",
+            dictName: "medical_instruments", // 字典名
+          },
+      
+        },
+        {
+          item:{
+            key:'commonName',
+            title:'通用名称',
+          },
+          attr:{
+            is: "el-input",
+          },
+      
+        },
+        {
+          item:{
+            key:'ratifyBatchNo',
+            title:'批准文号',
+          },
+          attr:{
+            is: "el-input",
+          },
+      
+        },
+        {
+          item:{
+            key:'dosageFromName',
+            title:'剂型',
+          },
+          attr:{
+            is: "el-popover-tree-select",
+            referName: "DOSAGEFORM_PARAM",
+            valueKey: "name",
+            dataMapping: {
+              dosageFrom:'id'
+            }
+          },
+        },
+        {
+          item:{
+            key:'oriRegistrationNo',
+            title:'旧注册证号',
+          },
+          attr:{
+            is: "el-input",
+          },
+      
+        },
+        {
+          item:{
+            key:'curingType',
+            title:'养护类型',
+          },
+          attr:{
+            is: "el-select",
+            dictName: "curing_type", // 字典名
+          },
+        }
+      ].map(({ item, attr }) => ({
+        attr,
+        item: { ...item, hidden: true, span: item.span || 6 },
+      })),
+    },
+    // 维护物料类别
+    {
+      item:{
+        key:'sysMaterialMedcineItemApply',
+        title:'维护物料类别',
+      },
+      attr:{
+        is: 'el-super-ux-table',
+        value:[]
+      },
+      TableColumns:[
+        {
+          item:{
+            key:'drugId',
+            title:'ID',
+          },
+          attr:{
+            is: "el-input",
+            readonly:true,
+          },
+         
+        },
+        {
+          item:{
+            key:'drugCode',
+            title:'药品类别编码',
+            require: true,
+          },
+          attr:{
+            is: "el-input",
+            readonly:true,
+          },
+         
+        },
+        {
+          item:{
+            key:'drugName',
+            title:'药品类别名称',
+            require: true,
+          },
+          attr:{
+            is: "el-input",
+            // MEDICINE_DRUG
+            // is: "el-popover-select-v2",
+            // valueKey: "name",
+            // referName: "ORG_PARAM",
+            // dataMapping: {
+            //   // drugCode: undefined,
+            //   // drugId: undefined
+            // },
+            readonly:true,
+          },
+         
+        },
+      ].map(({ item, attr }) => ({
+        attr,
+        item: { ...item, hidden: true, span: item.span || 6 },
+      }))
+    }, 
+    // 单据信息
+    {
+      item:{
+        key:'applyBillInfo',
+        title:'单据信息',
+      },
+      attr:{
+        is: 'el-super-form',
+        value:{},
+      },
+      TableColumns:[
+        {
+          item:{
+            key:'createByName',
+            title:'申请人',
+          },
+          attr:{
+            is: "el-input",
+            disabled:true,
+          },
+      
+        },
+        {
+          item:{
+            key:'createTime',
+            title:'申请时间',
+          },
+          attr:{
+            is: "el-date-picker",
+            valueFormat: "yyyy-MM-dd HH:mm:ss",
+            disabled:true,
+          },
+      
+        },
+        {
+          item:{
+            key:'createByName',
+            title:'创建人',
+          },
+          attr:{
+            is: "el-input",
+            disabled:true,
+          },
+      
+        },
+        {
+          item:{
+            key:'createTime',
+            title:'创建时间',
+          },
+          attr:{
+            is: "el-date-picker",
+            valueFormat: "yyyy-MM-dd HH:mm:ss",
+            disabled:true,
+          },
+      
+        },
+        {
+          item:{
+            key:'updateByName',
+            title:'最后修改人',
+          },
+          attr:{
+            is: "el-input",
+            disabled:true,
+          },
+      
+        },
+        {
+          item:{
+            key:'updateTime',
+            title:'最后修改时间',
+          },
+          attr:{
+            is: "el-date-picker",
+            valueFormat: "yyyy-MM-dd HH:mm:ss",
+            disabled:true,
+          },
+      
+        },
+        {
+          item:{
+            key:'status',
+            title:'单据状态',
+          },
+          attr:{
+            is: "el-select",
+            dictName: "documents_status", // 字典名
+            disabled:true,
+          },
+      
+        },
+        // {
+        //   item:{
+        //     key:'reviewedByName',
+        //     title:'最后审核人',
+        //   },
+        //   attr:{
+        //     is: "el-input",
+        //     disabled:true,
+        //   },
+      
+        // },
+        // {
+        //   item:{
+        //     key:'approvalTime',
+        //     title:'最后审核时间',
+        //   },
+        //   attr:{
+        //     is: "el-date-picker",
+        //     valueFormat: "yyyy-MM-dd HH:mm:ss",
+        //     disabled:true,
+        //   },
+      
+        // },
+        
+      ].map(({ item, attr }) => ({
+        attr,
+        item: { ...item, hidden: true, span: item.span || 6 },
+      })),
+    },
+  ]
+
+  const MaterialColums = [
+    {
+      item:{
+        key:'name',
+        title:'物料',
+      },
+      attr:{
+        is: "el-popover-select-v2",
+        valueKey: "name",
+        referName: "MATERIAL_PARAM",
+        dataMapping: {
+          classifyId: 'classifyId',
+          classifyName: 'classifyIdName',
+          isMedicine: 'isMedicine',
+          unitId: 'unitId',
+          unitName: 'unitIdName',
+          packExplain: 'packExplain',
+          isInventoryStatus: 'isInventoryStatus',
+          manufacturerId: 'manufacturerId',
+          manufacturerName: 'manufacturerIdName',
+          deliveryPeriod: 'deliveryPeriod',
+          expiryDateManagerment: 'expiryDateManagerment',
+          registrant: 'registrant',
+          minOrderQty: 'minOrderQty',
+          expiryUnitId: 'expiryUnitId',
+          productionPermit: 'productionPermit',
+          minPackQty: 'minPackQty',
+          usefulLife: 'usefulLife',
+          storageCondition: 'storageCondition',
+          minBatchQty: 'minBatchQty',
+          usefulLifeUnitId: 'usefulLifeUnitId',
+          transportationCondition: 'transportationCondition',
+          materialRate: 'materialRate',
+          materialRateName: 'materialRateName',
+          nearOnsetManagerment: 'nearOnsetManagerment',
+          originPlace: 'originPlace',
+          originPlaceName: 'originPlaceName',
+          purchasingOrganization: 'purchasingOrganization',
+          purchasingOrganizationName: 'purchasingOrganizationName',
+          recentWarningPeriod: 'recentWarningPeriod',
+          brand:'brand',
+          puPersonnelId:'puPersonnelId',
+          puPersonnelName:'puPersonnelIdName',
+        },
+      },
+    },
+  ]
+
+  return { TabColumns, MaterialColums }
+}
+

+ 771 - 0
src/views/material/requisition/details/index.vue

@@ -0,0 +1,771 @@
+<script>
+import useColumns from "./columns";
+import {
+  addReq,
+  getReqDetail,
+  editReq,
+  saveAndToOa,
+  betchSubmit,
+} from "@/api/requisition/basic";
+import { REFER } from "@/components/popover-select/api/index";
+export default {
+  name: "AddRequsition",
+  props: {
+    dict: {
+      type: [Object, Array],
+    },
+    addType: {
+      type: String,
+      default: "add",
+    },
+  },
+  components: {
+    ElSuperForm: () => import("@/components/super-form/index.vue"),
+    ElSuperTable: () => import("@/components/super-table/index.vue"),
+    ElSuperUxTable: () => import("@/components/super-ux-table/index.vue"),
+    ElPopoverSelectV2: () => import("@/components/popover-select-v2/index.vue"),
+    ElPopoverTreeSelect: () =>
+      import("@/components/popover-tree-select/index.vue"),
+  },
+  data() {
+    const {
+      MaterialColums,
+      TabColumns,
+      TabColumns: [
+        {
+          item: { key: tabName },
+        },
+      ],
+    } = useColumns();
+
+    let rules = TabColumns.reduce((pre, cur) => {
+      pre = {
+        ...pre,
+        ...this.$init.rules([...cur.TableColumns]),
+      };
+      return pre;
+    }, {});
+    const sysMaterialApply = this.$init.params([
+      ...TabColumns.find(({ item }) => item.key === "sysMaterialApply")
+        .TableColumns,
+    ]);
+    const sysMaterialMedcineApply = this.$init.params([
+      ...TabColumns.find(({ item }) => item.key === "sysMaterialMedcineApply")
+        .TableColumns,
+    ]);
+    const applyBillInfo = this.$init.params([
+      ...TabColumns.find(({ item }) => item.key === "applyBillInfo")
+        .TableColumns,
+    ]);
+    const materialReference = this.$init.params([...MaterialColums]);
+    return {
+      width: "100%",
+      visible: false,
+      loading: false,
+      rules,
+      params: {
+        sysMaterialApply: sysMaterialApply,
+        sysMaterialMedcineApply: sysMaterialMedcineApply,
+        sysMaterialMedcineItemApply: [],
+        applyBillInfo: applyBillInfo,
+      },
+      // 维护物料类别
+      maintenanceMaterialType: {
+        drugName: "",
+        drugCode: "",
+        drugId: "",
+      },
+      // 物料参考
+      materialReference: materialReference,
+      materialColums: MaterialColums[0],
+      tabName: tabName,
+      TabColumns: TabColumns,
+      count: 0,
+      delDemandItemList: [],
+    };
+  },
+  computed: {
+    title: {
+      get() {
+        const { addType } = this;
+        if (addType === "add") {
+          return "新 增";
+        }
+        if (addType === "edit") {
+          return "编 辑";
+        }
+        if (addType === "see") {
+          return "查 看";
+        }
+      },
+      set() {},
+    },
+  },
+  watch: {
+    "params.sysMaterialApply.isMedicine": {
+      handler: async function (nVal, oVal) {
+        this.params.sysMaterialMedcineApply.isDrug = nVal === "0" ? "2" : "";
+        if (nVal === "2") {
+          // 维护物料类别
+          try {
+            let { code, rows } = await REFER({
+              type: "MEDICINE_DRUG",
+              search: "其他非医疗器械",
+              isPage: false,
+            });
+
+            if (code == 200) {
+              console.log(rows, "rows");
+              let { id, code, name } = rows[0];
+              this.params.sysMaterialMedcineItemApply = [
+                {
+                  drugName: name,
+                  drugCode: code,
+                  drugId: id,
+                },
+              ];
+            }
+          } catch (error) {}
+        }
+      },
+    },
+    "params.sysMaterialApply.expiryDateManagerment": {
+      handler: function (nVal, oVal) {
+        if (nVal === "0") {
+          this.rules.expiryUnitId = [
+            {
+              required: true,
+              message: "效期单位",
+              trigger: "change",
+            },
+          ];
+          this.rules.usefulLife = [
+            {
+              required: true,
+              message: "有效期",
+              trigger: "change",
+            },
+          ];
+          this.rules.usefulLifeUnitId = [
+            {
+              required: true,
+              message: "有效期至单位",
+              trigger: "change",
+            },
+          ];
+          this.rules.recentWarningPeriod = [
+            {
+              required:
+                this.params.sysMaterialApply.nearOnsetManagerment === "0",
+              message: "近效期预警天数",
+              trigger: "change",
+            },
+          ];
+        } else {
+          this.rules.expiryUnitId = null;
+          this.rules.usefulLife = null;
+          this.rules.usefulLifeUnitId = null;
+          this.rules.recentWarningPeriod = null;
+          this.params.sysMaterialApply.nearOnsetManagerment = "2";
+        }
+        this.count++;
+      },
+    },
+    "params.sysMaterialApply.nearOnsetManagerment": {
+      handler: function (nVal, oVal) {
+        if (nVal === "0") {
+          this.rules.recentWarningPeriod = [
+            {
+              required:
+                this.params.sysMaterialApply.expiryDateManagerment === "0",
+              message: "近效期预警天数",
+              trigger: "change",
+            },
+          ];
+        } else {
+          this.rules.recentWarningPeriod = null;
+        }
+        this.count++;
+      },
+    },
+  },
+  methods: {
+    setVisible(prop) {
+      this.visible = prop;
+    },
+    beforeOpen() {
+      let { name, nickName, deptId, deptName, orgId, orgName } =
+        this.$store.state.user;
+      if (this.addType === "add") {
+        this.params.sysMaterialApply.isMedicine = "0";
+        this.params.sysMaterialApply.storageCondition = "MED2001";
+        this.params.sysMaterialApply.isInventoryStatus = "0";
+        this.params.sysMaterialApply.transportationCondition = "MED3003";
+        this.params.sysMaterialApply.isEnable = "0";
+        this.params.sysMaterialApply.materialRateName = "专票13%";
+        this.params.sysMaterialApply.materialRate = "1001A11000000000TPTF";
+        this.params.sysMaterialApply.proposerId = name;
+        this.params.sysMaterialApply.proposerName = nickName;
+        this.params.sysMaterialApply.orgId = "";
+        this.params.sysMaterialApply.orgName = "德荣集团";
+        this.params.sysMaterialApply.expiryDateManagerment = "0";
+        this.params.sysMaterialApply.nearOnsetManagerment = "0";
+        //
+        this.params.sysMaterialMedcineApply.dosageFrom = "0001A11000000000BX7Z";
+        this.params.sysMaterialMedcineApply.dosageFromName = "其他";
+      }
+      if (this.addType === "see") {
+        this.TabColumns = this.TabColumns.map((tab) => {
+          return {
+            ...tab,
+            TableColumns: tab.TableColumns.map(({ item, attr }) => {
+              return {
+                item: { ...item },
+                attr: {
+                  ...attr,
+                  disabled: true,
+                },
+              };
+            }),
+          };
+        });
+      }
+    },
+
+    //
+    async fetchItem(prop) {
+      console.log(prop, "prop----------------");
+      try {
+        // try
+        this.loading = true;
+
+        let { code, data } = await getReqDetail(prop.id);
+
+        if (code == 200) {
+          this.params = data;
+          // 复制
+          if (this.addType === "add") {
+            this.copyEmpty();
+          }
+        }
+      } catch (err) {
+        // catch
+        console.error(err);
+      } finally {
+        // finally
+        this.loading = false;
+      }
+    },
+
+    // 复制清空值
+    copyEmpty() {
+      const { id, name, nickName } = this.$store.state.user;
+      let {
+        sysMaterialApply,
+        sysMaterialMedcineApply,
+        sysMaterialMedcineItemApply,
+      } = this.params;
+      // 基本信息
+      sysMaterialApply["id"] = "";
+      sysMaterialApply["code"] = "";
+      sysMaterialApply["billCode"] = "";
+      sysMaterialApply["diCode"] = "";
+      sysMaterialApply["healthCode"] = "";
+      sysMaterialApply["proposerName"] = nickName;
+      sysMaterialApply["proposerId"] = name;
+      // 医药属性
+      sysMaterialMedcineApply["id"] = "";
+      // 维护物料类别
+      sysMaterialMedcineItemApply.length &&
+        (this.params.sysMaterialMedcineItemApply =
+          sysMaterialMedcineItemApply.map((item) => {
+            return {
+              ...item,
+              id: "",
+            };
+          }));
+      // 单据信息
+      this.params.applyBillInfo = {
+        ...this.$init.params([
+          ...this.TabColumns.find(({ item }) => item.key === "applyBillInfo")
+            .TableColumns,
+        ]),
+        auditTime: "",
+      };
+    },
+
+    //
+    async hide() {
+      const {
+        TabColumns,
+        TabColumns: [
+          {
+            item: { key: tabName },
+          },
+        ],
+      } = useColumns();
+      this.visible = false;
+      this.$emit("success");
+      this.tabName = tabName;
+      this.TabColumns = TabColumns;
+      this.params = {
+        sysMaterialApply: this.$init.params([
+          ...TabColumns.find(({ item }) => item.key === "sysMaterialApply")
+            .TableColumns,
+        ]),
+        sysMaterialMedcineApply: this.$init.params([
+          ...TabColumns.find(
+            ({ item }) => item.key === "sysMaterialMedcineApply"
+          ).TableColumns,
+        ]),
+        sysMaterialMedcineItemApply: [],
+        applyBillInfo: this.$init.params([
+          ...TabColumns.find(({ item }) => item.key === "applyBillInfo")
+            .TableColumns,
+        ]),
+      };
+    },
+    //
+    async useRowAdd(prop) {
+      let { open } = this.$refs.materialTypeTree[0];
+      open();
+      // const { TableColumns } = this.TabColumns.find(
+      //   ({ item: { key } }) => key === prop
+      // );
+      // this.params[prop].push({
+      //   delFlag: "0",
+      //   ...this.$init.params(TableColumns),
+      // });
+    },
+    //
+    async useRowRemove(prop, scope) {
+      scope.row.delFlag = "2";
+
+      let delList = [];
+
+      delList = this.params[prop].filter((item) => {
+        return item.delFlag == "2";
+      });
+      this.params[prop] = this.params[prop].filter((item) => {
+        return item.delFlag == "0";
+      });
+      this.delDemandItemList.push(...delList);
+    },
+    // saveParams
+    handleParams() {
+      let list = [];
+
+      let {
+        sysMaterialApply: { isMedicine },
+        sysMaterialMedcineItemApply,
+      } = this.params;
+
+      list.push(...sysMaterialMedcineItemApply, ...this.delDemandItemList);
+
+      // 深拷贝一下参数对象
+      let param = JSON.parse(JSON.stringify(this.params));
+      param.sysMaterialMedcineItemApply = list;
+
+      if (isMedicine === "0" && !sysMaterialMedcineItemApply.length) {
+        return this.$modal.notifyWarning("医药物料需要维护物料类别!");
+      }
+      console.log(param, "param最终保存传输的值");
+      return param;
+    },
+    // 保存
+    async useSave() {
+      try {
+        this.loading = true;
+        let params = await this.handleParams();
+        if (params) {
+          let { code, msg } =
+            this.addType === "add"
+              ? await addReq(params)
+              : await editReq(params);
+          code == 200 && this.hide();
+          this.$notify({
+            type: code == 200 ? "success" : "error",
+            message: msg,
+          });
+        }
+      } catch (error) {
+      } finally {
+        this.loading = false;
+      }
+    },
+    // 提交
+    async useSubmit() {
+      try {
+        this.loading = true;
+        let params = await this.handleParams();
+        if (params) {
+          let { code, msg } = await betchSubmit({ ids: [Number(params.id)] });
+          code == 200 && this.hide();
+          this.$notify({
+            type: code == 200 ? "success" : "error",
+            message: msg,
+          });
+        }
+      } catch (error) {
+      } finally {
+        this.loading = false;
+      }
+    },
+    // 保存并提交
+    async saveSubmit() {
+      try {
+        this.loading = true;
+        let params = await this.handleParams();
+        if (params) {
+          let { code, msg } = await saveAndToOa(params);
+          code == 200 && this.hide();
+          this.$notify({
+            type: code == 200 ? "success" : "error",
+            message: msg,
+          });
+        }
+      } catch (error) {
+      } finally {
+        this.loading = false;
+      }
+    },
+
+    materialTypeChange(tabName) {
+      let { drugId } = this.maintenanceMaterialType;
+
+      let isExist = this.params[tabName].find((item) => item.drugId === drugId);
+
+      if (isExist) {
+        this.$message.warning({
+          message: "请勿重复选择",
+        });
+      } else {
+        this.params[tabName].push({
+          ...this.maintenanceMaterialType,
+          delFlag: "0",
+        });
+      }
+    },
+    // 物料参考
+    openMaterialReference() {
+      let { open } = this.$refs.materialPopoverSelect[0];
+      open();
+    },
+    materialReferenceChange(prop, { source }) {
+      console.log(prop, "prop");
+      console.log(source, "source");
+      this.params.sysMaterialApply = {
+        ...this.params.sysMaterialApply,
+        ...source,
+      };
+    },
+  },
+  created() {},
+  mounted() {},
+  destroyed() {},
+};
+</script>
+
+<template>
+  <el-drawer
+    class="detailsRequsition"
+    v-bind="$attrs"
+    v-on="$listeners"
+    v-loading="loading"
+    :visible.sync="visible"
+    :size="width"
+    :show-close="false"
+    destroy-on-close
+    @close="hide"
+    @open="beforeOpen"
+  >
+    <div
+      slot="title"
+      style="display: flex; justify-content: space-between; align-items: center"
+    >
+      <h3>{{ title }}</h3>
+      <div>
+        <el-button
+          v-if="addType !== 'see'"
+          type="primary"
+          :size="$attrs.size"
+          :loading="loading"
+          @click="useSave"
+          >保 存</el-button
+        >
+        <el-button
+          v-if="
+            addType !== 'see' &&
+            (params.sysMaterialApply.status == '0' ||
+              params.sysMaterialApply.status == '3')
+          "
+          type="primary"
+          :size="$attrs.size"
+          :loading="loading"
+          @click="saveSubmit"
+          >保存并提交</el-button
+        >
+        <el-button
+          v-if="
+            addType === 'see' &&
+            (params.sysMaterialApply.status == '0' ||
+              params.sysMaterialApply.status == '3')
+          "
+          type="primary"
+          :size="$attrs.size"
+          :loading="loading"
+          @click="useSubmit"
+          >提交</el-button
+        >
+        <el-button :size="$attrs.size" :loading="loading" @click="hide"
+          >取 消</el-button
+        >
+      </div>
+    </div>
+
+    <el-tabs
+      v-model="tabName"
+      style="margin: 0 16px"
+      type="border-card"
+      :key="count"
+    >
+      <el-tab-pane
+        v-for="(
+          { item, TableColumns: columns, attr: { is } }, index
+        ) in TabColumns"
+        :key="index"
+        :label="item.title"
+        :name="item.key"
+        lazy
+      >
+        <!--  -->
+        <component
+          v-if="is === 'el-super-form' && visible"
+          :is="is"
+          v-model="params[item.key]"
+          :dict="dict"
+          :rules="rules"
+          :size="$attrs.size"
+          :columns="columns"
+          :ref="tabName"
+          label-width="166px"
+          label-position="right"
+          style="padding: 0px 18px"
+        >
+          <!-- 物料名称 -->
+          <template slot="name" slot-scope="scope">
+            <component
+              v-bind="scope.attr"
+              v-model="scope.row[scope.item.key]"
+              :size="$attrs.size"
+              :source.sync="scope.row"
+              :disabled="addType === 'see'"
+              style="width: 100%"
+            >
+              <el-button
+                slot="append"
+                icon="el-icon-search"
+                @click="openMaterialReference"
+              >
+                <el-popover-select-v2
+                  ref="materialPopoverSelect"
+                  v-show="false"
+                  title="物料"
+                  v-model="materialReference.name"
+                  :source.sync="materialReference"
+                  v-bind="materialColums.attr"
+                  style="width: 100%"
+                  @change="materialReferenceChange"
+                >
+                </el-popover-select-v2>
+              </el-button>
+            </component>
+          </template>
+          <!-- 药品 -->
+          <template slot="isDrug" slot-scope="scope">
+            <component
+              v-bind="scope.attr"
+              v-model="scope.row[scope.item.key]"
+              :size="$attrs.size"
+              :source.sync="scope.row"
+              :disabled="
+                params.sysMaterialApply.isMedicine !== '0' || addType === 'see'
+              "
+            >
+              <!-- @change="Change({ ...scope, selectData: $event })" -->
+              <el-option
+                v-for="item in dict.type[scope.attr.dictName]"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
+              >
+              </el-option>
+            </component>
+          </template>
+          <!-- 效期管理:expiryDateManagerment
+             近效期管理:nearOnsetManagerment -->
+          <!-- 有效期 -->
+          <template slot="usefulLife" slot-scope="scope">
+            <component
+              v-bind="scope.attr"
+              v-model="scope.row[scope.item.key]"
+              :size="$attrs.size"
+              :source.sync="scope.row"
+              :disabled="
+                params.sysMaterialApply.expiryDateManagerment !== '0' ||
+                addType === 'see'
+              "
+              style="width: 100%"
+            ></component>
+          </template>
+          <!-- 效期单位 -->
+          <template slot="expiryUnitId" slot-scope="scope">
+            <component
+              v-bind="scope.attr"
+              v-model="scope.row[scope.item.key]"
+              :size="$attrs.size"
+              :source.sync="scope.row"
+              :disabled="
+                params.sysMaterialApply.expiryDateManagerment !== '0' ||
+                addType === 'see'
+              "
+            >
+              <el-option
+                v-for="item in dict.type[scope.attr.dictName]"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
+              >
+              </el-option>
+            </component>
+          </template>
+          <!-- 有效期至单位 -->
+          <template slot="usefulLifeUnitId" slot-scope="scope">
+            <component
+              v-bind="scope.attr"
+              v-model="scope.row[scope.item.key]"
+              :size="$attrs.size"
+              :source.sync="scope.row"
+              :disabled="
+                params.sysMaterialApply.expiryDateManagerment !== '0' ||
+                addType === 'see'
+              "
+            >
+              <el-option
+                v-for="item in dict.type[scope.attr.dictName]"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
+              >
+              </el-option>
+            </component>
+          </template>
+
+          <!-- 近效期预警天数 -->
+          <template slot="recentWarningPeriod" slot-scope="scope">
+            <component
+              v-bind="scope.attr"
+              v-model="scope.row[scope.item.key]"
+              :size="$attrs.size"
+              :source.sync="scope.row"
+              :disabled="
+                params.sysMaterialApply.expiryDateManagerment !== '0' ||
+                addType === 'see'
+              "
+              style="width: 100%"
+            ></component>
+          </template>
+
+          <!-- 生产厂家/代理人 -->
+          <template slot="manufacturerName" slot-scope="scope">
+            <component
+              v-bind="scope.attr"
+              v-model="scope.row[scope.item.key]"
+              copy
+              readonly
+              :size="$attrs.size"
+              :source.sync="scope.row"
+              :disabled="addType === 'see'"
+              style="width: 100%"
+            ></component>
+          </template>
+        </component>
+
+        <!--  -->
+        <component
+          v-if="is === 'el-super-ux-table'"
+          :is="is"
+          v-model="params[item.key]"
+          :dict="dict"
+          :height="420"
+          :ref="tabName"
+          :columns="columns"
+          :size="$attrs.size"
+        >
+          <ux-table-column
+            fixed="right"
+            title="操作"
+            width="120"
+            align="center"
+          >
+            <template slot="header" slot-scope="scope">
+              <el-button
+                v-if="tabName === 'sysMaterialMedcineItemApply'"
+                type="text"
+                :size="$attrs.size"
+                :disabled="addType === 'see'"
+                @click="useRowAdd(tabName)"
+              >
+                增行
+                <el-popover-tree-select
+                  ref="materialTypeTree"
+                  v-show="false"
+                  v-model="maintenanceMaterialType.drugName"
+                  :source.sync="maintenanceMaterialType"
+                  referName="MEDICINE_DRUG"
+                  valueKey="name"
+                  :dataMapping="{
+                    drugCode: 'code',
+                    drugId: 'id',
+                  }"
+                  :defaultProps="{
+                    label: function (data, node) {
+                      return data.code + '' + data.name;
+                    },
+                    children: 'children',
+                  }"
+                  @change="materialTypeChange(tabName)"
+                ></el-popover-tree-select>
+              </el-button>
+            </template>
+            <template slot-scope="scope">
+              <el-button
+                type="text"
+                :size="$attrs.size"
+                :disabled="addType === 'see'"
+                @click.native.prevent="useRowRemove(tabName, scope)"
+              >
+                删除
+              </el-button>
+              <!-- <AmendantRecord
+                v-if="
+                  tabName === 'materialBasic' &&
+                  addType === 'edit' &&
+                  scope.row.id
+                "
+                v-model="scope.row"
+              ></AmendantRecord> -->
+            </template>
+          </ux-table-column>
+        </component>
+      </el-tab-pane>
+    </el-tabs>
+  </el-drawer>
+</template>
+
+<style scoped lang="scss">
+::v-deep.detailsRequsition .el-drawer__header {
+  margin: 0;
+  padding: 0 16px;
+}
+</style>

+ 14 - 0
src/views/material/requisition/dicts.js

@@ -0,0 +1,14 @@
+import { initDicts } from "@/utils/init.js";
+const modules = require.context("./", true, /columns.js$/);
+const columns = [];
+modules.keys().forEach((fileName) => {
+  const data = modules(fileName).default();
+  for (const key in data) {
+    if (key === "TabColumns") {
+      columns.push(...data[key].map((item) => item.TableColumns).flat());
+    } else {
+      columns.push(...data[key]);
+    }
+  }
+});
+export const dicts = initDicts(columns);

+ 504 - 363
src/views/material/requisition/index copy.vue

@@ -1,411 +1,552 @@
 <template>
   <div class="requisition" v-loading="failLoad">
     <div class="applyList" v-if="isList">
-      <el-row :gutter="10" class="mb10">
-        <el-col :span="1.5">
-          <span style="font-size: 14px;margin-right: 5px;">单据编码</span>
-          <el-input
-            v-model="queryParams.billCode"
-            size="small"
-            placeholder="请输入单据编码查询"
-            clearable
-            style="width: 240px"
-          />
-        </el-col>
+      <el-card
+        :body-style="{
+          height: '100%',
+          padding: 0,
+          display: 'flex',
+          'flex-direction': 'column',
+        }"
+      >
+        <el-super-search
+          v-model="params"
+          :size="size"
+          :dict="dict"
+          :columns="SearchColumns"
+          @reset="reset"
+          @submit="getList"
+        ></el-super-search>
 
-        <el-col :span="1.5">
-          <span style="font-size: 14px;margin-right: 5px;">物料名称</span>
-          <el-input
-            v-model="queryParams.name"
-            size="small"
-            placeholder="请输入物料名称查询"
-            clearable
-            style="width: 240px"
-          />
-        </el-col>
-
-        <el-col :span="1.5">
-          <span style="font-size: 14px;margin-right: 5px;">单据状态</span>
-          <el-select
-            v-model="queryParams.status"
-            size="small"
-            placeholder="请选择单据状态"
-            clearable
-            style="width: 240px">
-            <el-option
-              v-for="item in options"
-              :key="item.value"
-              :label="item.label"
-              :value="item.value">
-            </el-option>
-          </el-select>
-        </el-col>
-
-        <el-col :span="1.5">
-          <el-button type="primary" size="small" plain @click="getList(queryParams)">查询</el-button>
-        </el-col>
-        <!-- <el-col :span="1.5">
-          <el-button type="primary" size="small" plain>高级查询</el-button>
-        </el-col> -->
-        <el-col :span="1.5">
-          <el-button type="primary" size="small" plain @click="reset">重置</el-button>
-        </el-col>
-
-      </el-row>
-
-      <el-row :gutter="10" class="mb10">
-        <el-col :span="1.5">
-          <el-button type="primary" size="small" plain @click="newAdd">新增</el-button>
-        </el-col>
-        <el-col :span="1.5">
-          <el-button size="small" :disabled="checkedList.length != 1" @click="handleCopy">复制</el-button>
-        </el-col>
-        <el-col :span="1.5">
-          <el-button type="primary" size="small" plain
-                     @click="download('/system/apply/material/download',{},'申请单模板.xlsx')">模板下载
-          </el-button>
-        </el-col>
-        <el-col :span="1.5">
-          <el-button size="small" @click="handleImport">批量导入</el-button>
-        </el-col>
-        <!-- 导入弹窗 -->
-        <el-dialog 
-          title="批量导入" 
-          :visible.sync="importData.show" 
-          width="35%" 
-          center
-          :before-close="handlefileDialogColse"
+        <el-row
+          :gutter="10"
+          class="mb10"
+          type="flex"
+          justify="end"
+          style="margin-top: 15px"
         >
-          <div class="mb-import">
-            <el-upload 
-              accept=".xls, .xlsx" 
-              ref="upload" 
-              action="#" 
-              :on-remove="handleFileRemove"
-              :file-list="importData.list" 
-              :auto-upload="false" 
-              :on-change="handleChangeFile" 
-              :limit="1"
-              style="text-align: center;"
+          <el-col :span="1.5">
+            <el-button type="primary" :size="size" plain @click="newAdd"
+              >新增</el-button
             >
-              <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
-              <div slot="tip" class="el-upload__tip">只能上传Excel文件</div>
-            </el-upload>
-
-          </div>
-          <span slot="footer">
-        <el-button @click="handleImportData('cancal')">取 消</el-button>
-        <el-button type="primary" @click="handleImportData('confirm')">确 定</el-button>
-      </span>
-        </el-dialog>
-        <!-- <el-col :span="1.5">
-          <el-button type="primary" size="small" plain>导入</el-button>
-        </el-col>
-        <el-col :span="1.5">
-          <el-button type="primary" size="small" plain>导出</el-button>
-        </el-col> -->
-        <!-- <el-col :span="1.5">
-          <el-button type="primary" size="small" plain>批量提交</el-button>
-        </el-col>
-        <el-col :span="1.5">
-          <el-button type="primary" size="small" plain>批量删除</el-button>
-        </el-col> -->
-      </el-row>
+          </el-col>
+          <el-col :span="1.5">
+            <el-button
+              :size="size"
+              :disabled="checkedList.length != 1"
+              @click="handleCopy"
+              >复制</el-button
+            >
+          </el-col>
+          <el-col :span="1.5">
+            <el-button
+              type="primary"
+              :size="size"
+              plain
+              @click="
+                download(
+                  '/system/apply/material/download',
+                  {},
+                  '申请单模板.xlsx'
+                )
+              "
+              >模板下载
+            </el-button>
+          </el-col>
+          <el-col :span="1.5">
+            <el-button-group>
+              <el-button :size="size" @click="handleImport">批量导入</el-button>
+              <!-- <el-button  
+            :size="size"
+              @click="handleDownload" 
+              v-hasPermi="['system:apply:export']"
+            >批量导出</el-button> -->
+              <el-button :size="size" @click="handleBatchSubmit"
+                >批量提交</el-button
+              >
+            </el-button-group>
+          </el-col>
+          <!-- 导入弹窗 -->
+          <el-dialog
+            title="批量导入"
+            :visible.sync="importData.show"
+            width="35%"
+            center
+            :before-close="handlefileDialogColse"
+          >
+            <div class="mb-import">
+              <el-upload
+                accept=".xls, .xlsx"
+                ref="upload"
+                action="#"
+                :on-remove="handleFileRemove"
+                :file-list="importData.list"
+                :auto-upload="false"
+                :on-change="handleChangeFile"
+                :limit="1"
+                style="text-align: center"
+              >
+                <el-button slot="trigger" size="small" type="primary"
+                  >选取文件</el-button
+                >
+                <div slot="tip" class="el-upload__tip">只能上传Excel文件</div>
+              </el-upload>
+            </div>
+            <span slot="footer">
+              <el-button @click="handleImportData('cancal')">取 消</el-button>
+              <el-button type="primary" @click="handleImportData('confirm')"
+                >确 定</el-button
+              >
+            </span>
+          </el-dialog>
+        </el-row>
 
-      <el-card>
-        <el-table
-          :data="tableList"
-          class="request-table"
-          fit
-          max-height="680"
+        <el-super-ux-table
+          v-model="tableList"
+          :dict="dict"
+          :columns="TableColumns"
+          :size="size"
+          pagination
+          index
+          checkbox
+          convenitentOperation
+          :page="pageStatus"
+          storage-key="MaterialRequisitionSuperTable"
+          @pagination="getList"
+          @row-dblclick="check"
           @selection-change="handleSelectionChange"
           @select="handleSelect"
         >
-          <el-table-column type="selection" width="45"></el-table-column>
-          <el-table-column label="序号" align="center" type="index" width="50"/>
-          <el-table-column label="所属组织" align="center" width="200" prop="orgName"/>
-          <el-table-column label="单据编码" align="center" width="200" prop="billCode"/>
-          <el-table-column label="申请人" align="center" prop="createName"/>
-          <el-table-column label="申请时间" align="center" width="150" prop="createTime"/>
-          <el-table-column label="单据状态" align="center" prop="status" :formatter="statusJug"/>
-          <!-- <el-table-column label="物料编码" align="center" width="150" prop="materialCode" /> -->
-          <el-table-column label="物料名称" align="center" width="150" prop="name"/>
-          <el-table-column label="创建人" align="center" prop="createName"/>
-          <el-table-column label="创建时间" align="center" width="150" prop="createTime"/>
-          <el-table-column label="最后修改人" align="center" width="120" prop="updateName"/>
-          <el-table-column label="最后修改时间" align="center" width="150" prop="updateTime"/>
-          <el-table-column
+          <ux-table-column
             fixed="right"
-            label="操作"
+            title="操作"
             align="center"
             width="180"
           >
             <template slot-scope="scope">
-              <el-button type="text" size="small" @click="check(scope.row)">查看</el-button>
-              <el-button @click="edit(scope.row)" v-if="scope.row.status == 0 || scope.row.status == 3" type="text"
-                         size="small">编辑
-              </el-button>
-              <!-- <el-button @click="commit(scope.row)" v-if="scope.row.status == 0 || scope.row.status == 3" type="text" size="small">提交</el-button> -->
-              <el-button type="text" size="small" @click="deleteRow(scope.row)"
-                         v-if="scope.row.status == 0 || scope.row.status == 3">删除
-              </el-button>
+              <el-button type="text" :size="size" @click.stop="check(scope.row)"
+                >查看</el-button
+              >
+              <el-button
+                @click.stop="edit(scope.row)"
+                v-if="scope.row.status == 0 || scope.row.status == 3"
+                type="text"
+                :size="size"
+                >编辑</el-button
+              >
+              <el-button
+                @click.stop="jumpFlow(scope.row)"
+                v-if="scope.row.oaId && scope.row.oaId != ''"
+                type="text"
+                :size="size"
+                >流程跳转</el-button
+              >
+              <el-button
+                type="text"
+                :size="size"
+                @click.stop="deleteRow(scope.row)"
+                v-if="scope.row.status == 0 || scope.row.status == 3"
+                >删除</el-button
+              >
+              <el-button
+                v-if="scope.row.status == '1'"
+                type="text"
+                size="mini"
+                @click.stop="handleBack(scope.row)"
+                >流程收回</el-button
+              >
             </template>
-          </el-table-column>
-        </el-table>
-
-        <el-pagination
-          @size-change="handleSizeChange"
-          @current-change="handleCurrentChange"
-          :page-sizes="[5, 10, 15, 20]"
-          :page-size=queryParams.pageSize
-          layout="total, sizes, prev, pager, next, jumper"
-          :total="total"
-          style="text-align: center;">
-        </el-pagination>
+          </ux-table-column>
+        </el-super-ux-table>
       </el-card>
     </div>
 
-    <component :is="isComponent" v-model="isList" :pageStu="page" :disable="disable" :row="rowDetail" @refresh="getList"
-               v-if="!isList"/>
+    <component
+      :is="isComponent"
+      v-model="isList"
+      :pageStu="page"
+      :disable="disable"
+      :row="rowDetail"
+      @refresh="getList"
+      v-if="!isList"
+    />
   </div>
 </template>
 
 <script>
-  import addReq from './add.vue';
-  import {getReqList, delReq, importData, fileImport} from '@/api/requisition/basic';
-  import {saveAs} from "file-saver";
-  import { blobValidate } from "@/utils/ruoyi";
+import addReq from "./add.vue";
+import {
+  getReqList,
+  delReq,
+  importData,
+  fileImport,
+  betchSubmit,
+  toOA,
+  oaBack,
+} from "@/api/requisition/basic";
+import { saveAs } from "file-saver";
+import { blobValidate } from "@/utils/ruoyi";
+import { SearchColumns, TableColumns } from "./columns";
+import { initDicts } from "@/utils/init.js";
 
-  export default {
-    name: 'requisition',
-    components: {
-      addReq
-    },
-    data() {
-      return {
-        failLoad: false,
-        tableList: [],
-        queryParams: {
-          billCode: '',
-          name: '',
-          status: '',
-          pageNum: 1,
-          pageSize: 10
+export default {
+  name: "requisition",
+  dicts: [...initDicts([...SearchColumns, ...TableColumns]), "oa_templete_id"],
+  components: {
+    addReq,
+    ElSuperTable: () => import("@/components/super-table/index.vue"),
+    ElSuperUxTable: () => import("@/components/super-ux-table/index.vue"),
+    ElSuperSearch: () => import("@/components/super-search/index.vue"),
+  },
+  data() {
+    const params = this.$init.params(SearchColumns);
+    return {
+      failLoad: false,
+      tableList: [],
+      size: "mini",
+      params: params,
+      SearchColumns: SearchColumns,
+      TableColumns: TableColumns,
+      pageStatus: { pageNum: 1, pageSize: 50, total: 0 },
+      queryParams: {
+        billCode: "",
+        name: "",
+        status: "",
+        pageNum: 1,
+        pageSize: 10,
+      },
+      options: [
+        {
+          value: 0,
+          label: "未提交",
         },
-        options: [{
-          value: 0, label: '未提交'
-        }, {
-          value: 1, label: '审批中'
-        }, {
-          value: 2, label: '已完成'
-        }, {
-          value: 3, label: '已驳回'
-        },],
-        total: 0,
-        // isComponent
-        isComponent: 'addReq',
-        isList: true,
-        // 页面状态
-        page: '',
-        rowDetail: {},
-        disable: false,
-        checkedList: [],
-        importData: {
-          show: false,
-          list: []
+        {
+          value: 1,
+          label: "审批中",
         },
-      }
+        {
+          value: 2,
+          label: "已完成",
+        },
+        {
+          value: 3,
+          label: "已驳回",
+        },
+      ],
+      total: 0,
+      // isComponent
+      isComponent: "addReq",
+      isList: true,
+      // 页面状态
+      page: "",
+      rowDetail: {},
+      disable: false,
+      checkedList: [],
+      importData: {
+        show: false,
+        list: [],
+      },
+    };
+  },
+  created() {},
+  mounted() {
+    this.params.billCode = this.$route.query.billCode;
+    this.getList(this.queryParams);
+  },
+  methods: {
+    // 操作提示弹窗
+    handleConfirmTips(success) {
+      this.$confirm("是否继续此操作?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          success();
+        })
+        .catch(() => {});
     },
-    created() {
+    // 批量提交
+    async handleBatchSubmit() {
+      let filterList = this.checkedList.filter(
+        (item) => !(item.status === "0" || item.status === "3")
+      );
 
-    },
-    mounted() {
-      this.getList(this.queryParams)
-    },
-    methods: {
-      reset() {
-        this.queryParams.billCode = ''
-        this.queryParams.name = ''
-        this.queryParams.status = ''
-        this.queryParams.pageNum = 1
-        this.getList(this.queryParams)
-      },
-      newAdd() {
-        this.isList = false
-        this.isComponent = 'addReq'
-        this.page = 'add'
-        this.disable = false
-      },
-      // 复制
-      handleCopy() {
-        this.isList = false;
-        this.isComponent = 'addReq';
-        this.page = 'copy';
-        this.rowDetail = this.checkedList[0];
-        this.disable = false;
-      },
-      // 导入
-      handleImport() {
-        this.importData.show = true
-      },
-      // 删除文件
-      handleFileRemove(file, fileList) {
-        console.log('删除文件', file, 'file', fileList, 'fileList');
-        this.importData.list = fileList;
-      },
-      // 文件发生改变
-      handleChangeFile(file, fileList) {
-        this.importData.list = fileList;
-      },
-      // 导入弹窗操作
-      handleImportData(type) {
-        switch (type) {
-          // 取消
-          case 'cancal':
-            this.importData.list = [];
-            this.importData.show = false;
-            break;
-          // 确认
-          case 'confirm':
-            if (this.importData.list.length) {
+      console.log(filterList, "filterList", this.checkedList.length);
 
-              let formData = new FormData();
+      if (!filterList.length && this.checkedList.length) {
+        this.handleConfirmTips(async () => {
+          try {
+            this.failLoad = true;
 
-              formData.append('file', this.importData.list[0].raw);
-              importData(formData).then(res => {
-                if (res.code == 200) {
-                  this.importData.show = false;
-                  this.importData.list = [];
-                  if (res.data.flag) {
-                    this.failLoad = true;
-                    console.log(res.data.datas)
-                    let param = {failDatas: res.data.datas}
-                    if (null != param) {
+            let ids = this.checkedList.map((item) => Number(item.id));
 
-                      fileImport(param).then(res => {
-                        console.log('res',res)
-                        const isBlob = blobValidate(res);
-                        if (isBlob) {
-                          const blob = new Blob([res]);
-                          saveAs(blob, '导入失败的物料申请单数据.xlsx');
-                        }
-                        this.failLoad = false;
-                      })
-                    }
-                  }
-                  this.$message({
-                    message: res.data.msg,
-                    type: res.data.flag ? 'warning' : 'success'
-                  });
-                } else {
-                  this.$message({
-                    message: res.msg,
-                    type: res.code == 200 ? 'success' : 'warning'
-                  });
-                }
-              })
-            } else {
-              this.$message({
-                message: '请上传文件之后在确认!',
-                type: 'warning'
-              });
+            let { code, msg } = await betchSubmit({ ids });
+
+            if (code == 200) {
+              this.reset();
             }
-            break;
-        }
-      },
-      handlefileDialogColse(done){
-        this.importData.list = [];
-        done();
-      },
-      // Select框
-      handleSelect(selection, row) {
 
-        this.checkedList = selection;
+            this.$notify({
+              title: code == 200 ? msg : "error",
+              type: code == 200 ? "success" : "error",
+              message: code == 200 ? "" : msg,
+            });
+          } catch (error) {
+          } finally {
+            this.failLoad = false;
+          }
+        });
+      } else {
+        this.$notify.warning({
+          title: "警告",
+          message: "存在不符合提交条件数据或未选择数据!",
+        });
+      }
+    },
 
-        console.log(this.checkedList, 'this.checkedList');
+    async jumpFlow(row) {
+      const { name } = this.$store.state.user;
 
-      },
-      getList(val) {
-        console.log('val', val)
-        getReqList(val).then(res => {
-          if (res.code === 200) {
-            this.tableList = res.rows
-            this.total = res.total
-          }
-        })
-        this.checkedList = [];
-      },
-      // 表格内状态栏判断值
-      statusJug(row) {
-        if (row.status == 0) {
-          return '未提交'
-        } else if (row.status == 1) {
-          return '审批中'
-        } else if (row.status == 2) {
-          return '已完成'
-        } else if (row.status == 3) {
-          return '已驳回'
+      try {
+        let { code, msg, oaUrl } = await toOA(name, row.oaId);
+
+        if (code == 200) {
+          window.open(oaUrl);
         }
-      },
-      //
-      handleSelectionChange() {
+      } catch (error) {
+      } finally {
+      }
+    },
 
-      },
-      check(row) {
-        console.log('查看详情', row)
-        this.isList = false
-        this.isComponent = 'addReq'
-        this.page = 'check'
-        this.rowDetail = row
-        this.disable = true
-      },
-      edit(row) {
-        console.log('修改先加载详情', row)
-        this.isList = false
-        this.isComponent = 'addReq'
-        this.page = 'edit'
-        this.rowDetail = row
-        this.disable = false
-      },
-      commit(row) {
-        console.log('row', row)
-      },
-      deleteRow(row) {
-        this.$confirm('是否删除此条数据?', '提示', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        }).then(() => {
-          delReq(row.id).then(res => {
+    reset() {
+      // this.queryParams.billCode = ''
+      // this.queryParams.name = ''
+      // this.queryParams.status = ''
+      // this.queryParams.pageNum = 1
+      this.pageStatus.pageNum = 1;
+      this.pageStatus.pageSize = 10;
+      this.params = this.$init.params(SearchColumns);
+      this.getList(this.queryParams);
+    },
+    newAdd() {
+      this.isList = false;
+      this.isComponent = "addReq";
+      this.page = "add";
+      this.disable = false;
+    },
+    // 复制
+    handleCopy() {
+      this.isList = false;
+      this.isComponent = "addReq";
+      this.page = "copy";
+      this.rowDetail = this.checkedList[0];
+      this.disable = false;
+    },
+    // 导入
+    handleImport() {
+      this.importData.show = true;
+    },
+    // 导出
+    handleDownload() {
+      let params = {
+        ...this.params,
+      };
+      this.download(
+        "/system/apply/material/export",
+        { ...params },
+        `物料申请单${new Date().getTime()}.xlsx`
+      );
+    },
+    // 删除文件
+    handleFileRemove(file, fileList) {
+      // console.log('删除文件', file, 'file', fileList, 'fileList');
+      this.importData.list = fileList;
+    },
+    // 文件发生改变
+    handleChangeFile(file, fileList) {
+      this.importData.list = fileList;
+    },
+    // 导入弹窗操作
+    handleImportData(type) {
+      switch (type) {
+        // 取消
+        case "cancal":
+          this.importData.list = [];
+          this.importData.show = false;
+          break;
+        // 确认
+        case "confirm":
+          if (this.importData.list.length) {
+            let formData = new FormData();
+
+            formData.append("file", this.importData.list[0].raw);
+            importData(formData).then((res) => {
+              if (res.code == 200) {
+                this.importData.show = false;
+                this.importData.list = [];
+                if (res.data.flag) {
+                  this.failLoad = true;
+                  // console.log(res.data.datas)
+                  let param = { failDatas: res.data.datas };
+                  if (null != param) {
+                    fileImport(param).then((res) => {
+                      console.log("res", res);
+                      const isBlob = blobValidate(res);
+                      if (isBlob) {
+                        const blob = new Blob([res]);
+                        saveAs(blob, "导入失败的物料申请单数据.xlsx");
+                      }
+                      this.failLoad = false;
+                      this.reset();
+                    });
+                  }
+                }
+                this.$message({
+                  message: res.data.msg,
+                  type: res.data.flag ? "warning" : "success",
+                });
+              } else {
+                this.$message({
+                  message: res.msg,
+                  type: res.code == 200 ? "success" : "warning",
+                });
+              }
+            });
+          } else {
+            this.$message({
+              message: "请上传文件之后在确认!",
+              type: "warning",
+            });
+          }
+          break;
+      }
+    },
+    handlefileDialogColse(done) {
+      this.importData.list = [];
+      done();
+    },
+    // Select框
+    handleSelect(selection, row) {
+      this.checkedList = selection;
+
+      // console.log(this.checkedList, 'this.checkedList');
+    },
+    getList(val) {
+      // console.log('val', val)
+      this.failLoad = true;
+
+      getReqList({ ...this.params, ...this.pageStatus }).then((res) => {
+        this.failLoad = false;
+        if (res.code === 200) {
+          this.tableList = res.rows;
+          // this.total = res.total;
+          this.pageStatus.total = res.total;
+        }
+      });
+      // this.checkedList = [];
+    },
+    // 表格内状态栏判断值
+    statusJug(row) {
+      if (row.status == 0) {
+        return "未提交";
+      } else if (row.status == 1) {
+        return "审批中";
+      } else if (row.status == 2) {
+        return "已完成";
+      } else if (row.status == 3) {
+        return "已驳回";
+      }
+    },
+    //
+    handleSelectionChange(selection) {
+      this.checkedList = selection;
+    },
+    check(row) {
+      console.log("xxxx", this.dict.type);
+      // console.log('查看详情', row)
+      this.isList = false;
+      this.isComponent = "addReq";
+      this.page = "check";
+      this.rowDetail = row;
+      this.disable = true;
+    },
+    edit(row) {
+      // console.log('修改先加载详情', row)
+      this.isList = false;
+      this.isComponent = "addReq";
+      this.page = "edit";
+      this.rowDetail = row;
+      this.disable = false;
+    },
+    commit(row) {
+      // console.log('row', row)
+    },
+    deleteRow(row) {
+      this.$confirm("是否删除此条数据?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          delReq(row.id).then((res) => {
             if (res.code === 200) {
               this.$message({
                 message: res.msg,
-                type: 'success'
+                type: "success",
               });
-              this.getList(this.queryParams)
+              this.getList(this.queryParams);
             }
-          })
-        }).catch(() => {
+          });
         })
-      },
-      handleSizeChange(val) {
-        console.log(`每页 ${val} 条`);
-        this.queryParams.pageSize = val
-        this.getList(this.queryParams)
-      },
-      handleCurrentChange(val) {
-        console.log(`当前页: ${val}`);
-        this.queryParams.pageNum = val
-        this.getList(this.queryParams)
+        .catch(() => {});
+    },
+    // handleSizeChange(val) {
+    //   console.log(`每页 ${val} 条`);
+    //   this.queryParams.pageSize = val
+    //   this.getList(this.queryParams)
+    // },
+    // handleCurrentChange(val) {
+    //   console.log(`当前页: ${val}`);
+    //   this.queryParams.pageNum = val
+    //   this.getList(this.queryParams)
+    // }
+    //流程收回
+    async handleBack(row) {
+      try {
+        const { msg, code } = await oaBack({
+          fdTemplateId: this.dict.type.oa_templete_id.find((item) => {
+            return item.label == "物料申请单";
+          }).value,
+          fdId: row.oaId,
+          billCode: row.billCode,
+          billMaker: row.createBy,
+        });
+        if (code === 200) {
+          this.$emit("success");
+          this.$notify.success(msg);
+        }
+      } catch (err) {
+        console.error(err);
+      } finally {
+        this.getList(this.queryParams);
       }
-    }
-  }
+    },
+  },
+};
 </script>
 
 <style scoped lang="scss">
-  .requisition {
-    height: calc(100vh - 84px);
-    padding: 12px;
-    box-sizing: border-box;
-  }
+.requisition {
+  // height: calc(100vh - 84px);
+  // padding: 12px;
+  // box-sizing: border-box;
+}
+.el-card {
+  width: calc(100% - 32px);
+  height: calc(100vh - 32px);
+  margin: 16px;
+  padding: 16px;
+  border-radius: 8px;
+}
 </style>

+ 258 - 448
src/views/material/requisition/index.vue

@@ -1,180 +1,5 @@
-<template>
-  <div class="requisition" v-loading="failLoad">
-    <div class="applyList" v-if="isList">
-      <el-card
-        :body-style="{
-          height: '100%',
-          padding: 0,
-          display: 'flex',
-          'flex-direction': 'column',
-        }"
-      >
-        <el-super-search
-          v-model="params"
-          :size="size"
-          :dict="dict"
-          :columns="SearchColumns"
-          @reset="reset"
-          @submit="getList"
-        ></el-super-search>
-
-        <el-row
-          :gutter="10"
-          class="mb10"
-          type="flex"
-          justify="end"
-          style="margin-top: 15px"
-        >
-          <el-col :span="1.5">
-            <el-button type="primary" :size="size" plain @click="newAdd"
-              >新增</el-button
-            >
-          </el-col>
-          <el-col :span="1.5">
-            <el-button
-              :size="size"
-              :disabled="checkedList.length != 1"
-              @click="handleCopy"
-              >复制</el-button
-            >
-          </el-col>
-          <el-col :span="1.5">
-            <el-button
-              type="primary"
-              :size="size"
-              plain
-              @click="
-                download(
-                  '/system/apply/material/download',
-                  {},
-                  '申请单模板.xlsx'
-                )
-              "
-              >模板下载
-            </el-button>
-          </el-col>
-          <el-col :span="1.5">
-            <el-button-group>
-              <el-button :size="size" @click="handleImport">批量导入</el-button>
-              <!-- <el-button  
-            :size="size"
-              @click="handleDownload" 
-              v-hasPermi="['system:apply:export']"
-            >批量导出</el-button> -->
-              <el-button :size="size" @click="handleBatchSubmit"
-                >批量提交</el-button
-              >
-            </el-button-group>
-          </el-col>
-          <!-- 导入弹窗 -->
-          <el-dialog
-            title="批量导入"
-            :visible.sync="importData.show"
-            width="35%"
-            center
-            :before-close="handlefileDialogColse"
-          >
-            <div class="mb-import">
-              <el-upload
-                accept=".xls, .xlsx"
-                ref="upload"
-                action="#"
-                :on-remove="handleFileRemove"
-                :file-list="importData.list"
-                :auto-upload="false"
-                :on-change="handleChangeFile"
-                :limit="1"
-                style="text-align: center"
-              >
-                <el-button slot="trigger" size="small" type="primary"
-                  >选取文件</el-button
-                >
-                <div slot="tip" class="el-upload__tip">只能上传Excel文件</div>
-              </el-upload>
-            </div>
-            <span slot="footer">
-              <el-button @click="handleImportData('cancal')">取 消</el-button>
-              <el-button type="primary" @click="handleImportData('confirm')"
-                >确 定</el-button
-              >
-            </span>
-          </el-dialog>
-        </el-row>
-
-        <el-super-ux-table
-          v-model="tableList"
-          :dict="dict"
-          :columns="TableColumns"
-          :size="size"
-          pagination
-          index
-          checkbox
-          convenitentOperation
-          :page="pageStatus"
-          storage-key="MaterialRequisitionSuperTable"
-          @pagination="getList"
-          @row-dblclick="check"
-          @selection-change="handleSelectionChange"
-          @select="handleSelect"
-        >
-          <ux-table-column
-            fixed="right"
-            title="操作"
-            align="center"
-            width="180"
-          >
-            <template slot-scope="scope">
-              <el-button type="text" :size="size" @click.stop="check(scope.row)"
-                >查看</el-button
-              >
-              <el-button
-                @click.stop="edit(scope.row)"
-                v-if="scope.row.status == 0 || scope.row.status == 3"
-                type="text"
-                :size="size"
-                >编辑</el-button
-              >
-              <el-button
-                @click.stop="jumpFlow(scope.row)"
-                v-if="scope.row.oaId && scope.row.oaId != ''"
-                type="text"
-                :size="size"
-                >流程跳转</el-button
-              >
-              <el-button
-                type="text"
-                :size="size"
-                @click.stop="deleteRow(scope.row)"
-                v-if="scope.row.status == 0 || scope.row.status == 3"
-                >删除</el-button
-              >
-              <el-button
-                v-if="scope.row.status == '1'"
-                type="text"
-                size="mini"
-                @click.stop="handleBack(scope.row)"
-                >流程收回</el-button
-              >
-            </template>
-          </ux-table-column>
-        </el-super-ux-table>
-      </el-card>
-    </div>
-
-    <component
-      :is="isComponent"
-      v-model="isList"
-      :pageStu="page"
-      :disable="disable"
-      :row="rowDetail"
-      @refresh="getList"
-      v-if="!isList"
-    />
-  </div>
-</template>
-
 <script>
-import addReq from "./add.vue";
+import useColumns from "./columns";
 import {
   getReqList,
   delReq,
@@ -186,100 +11,138 @@ import {
 } from "@/api/requisition/basic";
 import { saveAs } from "file-saver";
 import { blobValidate } from "@/utils/ruoyi";
-import { SearchColumns, TableColumns } from "./columns";
-import { initDicts } from "@/utils/init.js";
-
+import { dicts } from "./dicts";
 export default {
   name: "requisition",
-  dicts: [...initDicts([...SearchColumns, ...TableColumns]), "oa_templete_id"],
+  dicts: [...dicts, "oa_templete_id"],
   components: {
-    addReq,
+    DetailsRequsition: () => import("./details/index.vue"),
     ElSuperTable: () => import("@/components/super-table/index.vue"),
     ElSuperUxTable: () => import("@/components/super-ux-table/index.vue"),
     ElSuperSearch: () => import("@/components/super-search/index.vue"),
+    BatchImport: () => import("@/components/BatchImport/index.vue"),
   },
   data() {
+    const { SearchColumns, TableColumns } = useColumns();
+    const page = this.$init.page();
     const params = this.$init.params(SearchColumns);
     return {
-      failLoad: false,
-      tableList: [],
+      loading: false,
       size: "mini",
+      page: page,
       params: params,
+      tableData: [],
+      selectData: [],
       SearchColumns: SearchColumns,
       TableColumns: TableColumns,
-      pageStatus: { pageNum: 1, pageSize: 50, total: 0 },
-      queryParams: {
-        billCode: "",
-        name: "",
-        status: "",
-        pageNum: 1,
-        pageSize: 10,
-      },
-      options: [
-        {
-          value: 0,
-          label: "未提交",
-        },
-        {
-          value: 1,
-          label: "审批中",
-        },
-        {
-          value: 2,
-          label: "已完成",
-        },
-        {
-          value: 3,
-          label: "已驳回",
-        },
-      ],
-      total: 0,
-      // isComponent
-      isComponent: "addReq",
-      isList: true,
-      // 页面状态
-      page: "",
-      rowDetail: {},
-      disable: false,
-      checkedList: [],
-      importData: {
-        show: false,
-        list: [],
-      },
+      addType: "add",
     };
   },
   created() {},
   mounted() {
     this.params.billCode = this.$route.query.billCode;
-    this.getList(this.queryParams);
+    this.useQuery(this.params, this.page);
   },
   methods: {
-    // 操作提示弹窗
-    handleConfirmTips(success) {
-      this.$confirm("是否继续此操作?", "提示", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning",
-      })
-        .then(() => {
-          success();
-        })
-        .catch(() => {});
+    async useQuery(prop, page) {
+      try {
+        this.loading = true;
+
+        let { code, rows, total } = await getReqList({ ...prop, ...page });
+
+        if (code == 200) {
+          this.tableData = rows;
+          this.page.total = total;
+        }
+      } catch (error) {
+        console.log(error);
+      } finally {
+        this.loading = false;
+      }
+    },
+    // 打开详细
+    openDetails(option, prop) {
+      this.addType = option;
+
+      let { setVisible, fetchItem } = this.$refs.detailsRequsition;
+
+      setVisible(true);
+
+      prop && fetchItem(prop);
+    },
+    //
+    handleDbclick(prop) {
+      this.openDetails("see", prop);
+    },
+
+    handleSelectionChange(selection) {
+      this.selectData = selection;
+    },
+    // 流程跳转
+    async jumpFlow(row) {
+      const { name } = this.$store.state.user;
+
+      try {
+        let { code, msg, oaUrl } = await toOA(name, row.oaId);
+
+        if (code == 200) {
+          window.open(oaUrl);
+        }
+      } catch (error) {
+      } finally {
+      }
+    },
+    //流程收回
+    async handleBack(row) {
+      try {
+        const { msg, code } = await oaBack({
+          fdTemplateId: this.dict.type.oa_templete_id.find((item) => {
+            return item.label == "物料申请单";
+          }).value,
+          fdId: row.oaId,
+          billCode: row.billCode,
+          billMaker: row.createBy,
+        });
+        if (code === 200) {
+          this.$emit("success");
+          this.$notify.success(msg);
+        }
+      } catch (err) {
+        console.error(err);
+      } finally {
+        this.getList(this.queryParams);
+      }
+    },
+    // 删行
+    deleteRow(row) {
+      this.handleConfirmTips(async () => {
+        try {
+          let { code } = await delReq(row.id);
+
+          if (res.code === 200) {
+            this.$message.success(res.msg);
+            this.useQuery(this.params, this.page);
+          }
+        } catch (error) {}
+      });
+    },
+    reset() {
+      this.page = this.$init.page();
+      this.params = this.$init.params(SearchColumns);
+      this.useQuery(this.params, this.page);
     },
     // 批量提交
-    async handleBatchSubmit() {
-      let filterList = this.checkedList.filter(
+    batchSubmit() {
+      let filterList = this.selectData.filter(
         (item) => !(item.status === "0" || item.status === "3")
       );
 
-      console.log(filterList, "filterList", this.checkedList.length);
-
-      if (!filterList.length && this.checkedList.length) {
+      if (!filterList.length && this.selectData.length) {
         this.handleConfirmTips(async () => {
           try {
             this.failLoad = true;
 
-            let ids = this.checkedList.map((item) => Number(item.id));
+            let ids = this.selectData.map((item) => Number(item.id));
 
             let { code, msg } = await betchSubmit({ ids });
 
@@ -299,249 +162,196 @@ export default {
         });
       } else {
         this.$notify.warning({
-          title: "警告",
           message: "存在不符合提交条件数据或未选择数据!",
         });
       }
     },
+    // 导入
+    async handelImport(fileList) {
+      let formData = new FormData();
 
-    async jumpFlow(row) {
-      const { name } = this.$store.state.user;
+      formData.append("file", fileList[0].raw);
+
+      let { setVisible } = this.$refs.batchImport;
+
+      setVisible(false);
 
       try {
-        let { code, msg, oaUrl } = await toOA(name, row.oaId);
+        this.loading = true;
+        let { code, msg, data } = await importData(formData);
 
         if (code == 200) {
-          window.open(oaUrl);
+          // 存在导入失败的数据
+          data.flag && (await this.exportfail(data.datas));
+
+          this.$notify({
+            message: data.msg,
+            type: data.flag ? "warning" : "success",
+          });
+        } else {
+          this.$notify({
+            message: msg,
+            type: code == 200 ? "success" : "warning",
+          });
         }
       } catch (error) {
       } finally {
+        this.loading = false;
       }
     },
+    // 导出失败数据
+    async exportfail(prop) {
+      try {
+        this.loading = true;
 
-    reset() {
-      // this.queryParams.billCode = ''
-      // this.queryParams.name = ''
-      // this.queryParams.status = ''
-      // this.queryParams.pageNum = 1
-      this.pageStatus.pageNum = 1;
-      this.pageStatus.pageSize = 10;
-      this.params = this.$init.params(SearchColumns);
-      this.getList(this.queryParams);
-    },
-    newAdd() {
-      this.isList = false;
-      this.isComponent = "addReq";
-      this.page = "add";
-      this.disable = false;
-    },
-    // 复制
-    handleCopy() {
-      this.isList = false;
-      this.isComponent = "addReq";
-      this.page = "copy";
-      this.rowDetail = this.checkedList[0];
-      this.disable = false;
-    },
-    // 导入
-    handleImport() {
-      this.importData.show = true;
-    },
-    // 导出
-    handleDownload() {
-      let params = {
-        ...this.params,
-      };
-      this.download(
-        "/system/apply/material/export",
-        { ...params },
-        `物料申请单${new Date().getTime()}.xlsx`
-      );
-    },
-    // 删除文件
-    handleFileRemove(file, fileList) {
-      // console.log('删除文件', file, 'file', fileList, 'fileList');
-      this.importData.list = fileList;
-    },
-    // 文件发生改变
-    handleChangeFile(file, fileList) {
-      this.importData.list = fileList;
-    },
-    // 导入弹窗操作
-    handleImportData(type) {
-      switch (type) {
-        // 取消
-        case "cancal":
-          this.importData.list = [];
-          this.importData.show = false;
-          break;
-        // 确认
-        case "confirm":
-          if (this.importData.list.length) {
-            let formData = new FormData();
+        let res = await fileImport({ failDatas: prop });
 
-            formData.append("file", this.importData.list[0].raw);
-            importData(formData).then((res) => {
-              if (res.code == 200) {
-                this.importData.show = false;
-                this.importData.list = [];
-                if (res.data.flag) {
-                  this.failLoad = true;
-                  // console.log(res.data.datas)
-                  let param = { failDatas: res.data.datas };
-                  if (null != param) {
-                    fileImport(param).then((res) => {
-                      console.log("res", res);
-                      const isBlob = blobValidate(res);
-                      if (isBlob) {
-                        const blob = new Blob([res]);
-                        saveAs(blob, "导入失败的物料申请单数据.xlsx");
-                      }
-                      this.failLoad = false;
-                      this.reset();
-                    });
-                  }
-                }
-                this.$message({
-                  message: res.data.msg,
-                  type: res.data.flag ? "warning" : "success",
-                });
-              } else {
-                this.$message({
-                  message: res.msg,
-                  type: res.code == 200 ? "success" : "warning",
-                });
-              }
-            });
-          } else {
-            this.$message({
-              message: "请上传文件之后在确认!",
-              type: "warning",
-            });
-          }
-          break;
-      }
-    },
-    handlefileDialogColse(done) {
-      this.importData.list = [];
-      done();
-    },
-    // Select框
-    handleSelect(selection, row) {
-      this.checkedList = selection;
+        const isBlob = blobValidate(res);
 
-      // console.log(this.checkedList, 'this.checkedList');
-    },
-    getList(val) {
-      // console.log('val', val)
-      this.failLoad = true;
+        if (isBlob) {
+          const blob = new Blob([res]);
+
+          await saveAs(blob, "导入失败的物料申请单数据.xlsx");
 
-      getReqList({ ...this.params, ...this.pageStatus }).then((res) => {
-        this.failLoad = false;
-        if (res.code === 200) {
-          this.tableList = res.rows;
-          // this.total = res.total;
-          this.pageStatus.total = res.total;
+          this.reset();
         }
-      });
-      // this.checkedList = [];
-    },
-    // 表格内状态栏判断值
-    statusJug(row) {
-      if (row.status == 0) {
-        return "未提交";
-      } else if (row.status == 1) {
-        return "审批中";
-      } else if (row.status == 2) {
-        return "已完成";
-      } else if (row.status == 3) {
-        return "已驳回";
+      } catch (error) {
+      } finally {
+        this.loading = false;
       }
     },
-    //
-    handleSelectionChange(selection) {
-      this.checkedList = selection;
-    },
-    check(row) {
-      console.log("xxxx", this.dict.type);
-      // console.log('查看详情', row)
-      this.isList = false;
-      this.isComponent = "addReq";
-      this.page = "check";
-      this.rowDetail = row;
-      this.disable = true;
-    },
-    edit(row) {
-      // console.log('修改先加载详情', row)
-      this.isList = false;
-      this.isComponent = "addReq";
-      this.page = "edit";
-      this.rowDetail = row;
-      this.disable = false;
+    // 模板下载,
+    handleTemDownload() {
+      this.download("/system/apply/material/download", {}, "申请单模板.xlsx");
     },
-    commit(row) {
-      // console.log('row', row)
-    },
-    deleteRow(row) {
-      this.$confirm("是否删除此条数据?", "提示", {
+    // 操作提示弹窗
+    handleConfirmTips(success) {
+      this.$confirm("是否继续此操作?", "提示", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
         type: "warning",
       })
         .then(() => {
-          delReq(row.id).then((res) => {
-            if (res.code === 200) {
-              this.$message({
-                message: res.msg,
-                type: "success",
-              });
-              this.getList(this.queryParams);
-            }
-          });
+          success();
         })
         .catch(() => {});
     },
-    // handleSizeChange(val) {
-    //   console.log(`每页 ${val} 条`);
-    //   this.queryParams.pageSize = val
-    //   this.getList(this.queryParams)
-    // },
-    // handleCurrentChange(val) {
-    //   console.log(`当前页: ${val}`);
-    //   this.queryParams.pageNum = val
-    //   this.getList(this.queryParams)
-    // }
-    //流程收回
-    async handleBack(row) {
-      try {
-        const { msg, code } = await oaBack({
-          fdTemplateId: this.dict.type.oa_templete_id.find((item) => {
-            return item.label == "物料申请单";
-          }).value,
-          fdId: row.oaId,
-          billCode: row.billCode,
-          billMaker: row.createBy,
-        });
-        if (code === 200) {
-          this.$emit("success");
-          this.$notify.success(msg);
-        }
-      } catch (err) {
-        console.error(err);
-      } finally {
-        this.getList(this.queryParams);
-      }
-    },
   },
 };
 </script>
 
+<template>
+  <el-card
+    v-loading="loading"
+    :body-style="{
+      height: '100%',
+      padding: 0,
+      display: 'flex',
+      'flex-direction': 'column',
+    }"
+  >
+    <el-super-search
+      v-model="params"
+      :size="size"
+      :dict="dict"
+      :columns="SearchColumns"
+      @reset="reset"
+      @submit="useQuery(params, page)"
+    ></el-super-search>
+
+    <el-row :gutter="24" type="flex" justify="end" style="margin: 16px 0 12px">
+      <el-col :span="24" style="text-align: right">
+        <el-button-group style="margin-left: 10px">
+          <el-button :size="size" type="primary" @click="openDetails('add')"
+            >新增</el-button
+          >
+          <el-button
+            :size="size"
+            :disabled="selectData.length !== 1"
+            @click="openDetails('add', selectData[0])"
+            >复制</el-button
+          >
+        </el-button-group>
+        <el-button-group style="margin: 0 10px">
+          <el-button :size="size" @click="batchSubmit">批量提交</el-button>
+        </el-button-group>
+        <BatchImport
+          ref="batchImport"
+          @import="handelImport"
+          @temDownload="handleTemDownload"
+          :fileSize="2"
+        ></BatchImport>
+      </el-col>
+    </el-row>
+
+    <el-super-ux-table
+      v-model="tableData"
+      :dict="dict"
+      :columns="TableColumns"
+      :size="size"
+      pagination
+      index
+      checkbox
+      convenitentOperation
+      :page="page"
+      storage-key="MaterialRequisitionSuperTable"
+      @pagination="useQuery(params, page)"
+      @row-dblclick="handleDbclick"
+      @selection-change="handleSelectionChange"
+    >
+      <ux-table-column fixed="right" title="操作" align="center" width="180">
+        <template slot-scope="scope">
+          <el-button
+            type="text"
+            :size="size"
+            @click.stop="openDetails('see', scope.row)"
+            >查看</el-button
+          >
+          <el-button
+            @click.stop="openDetails('edit', scope.row)"
+            v-if="scope.row.status == 0 || scope.row.status == 3"
+            type="text"
+            :size="size"
+            >编辑</el-button
+          >
+          <el-button
+            @click.stop="jumpFlow(scope.row)"
+            v-if="scope.row.oaId && scope.row.oaId != ''"
+            type="text"
+            :size="size"
+            >流程跳转</el-button
+          >
+          <el-button
+            type="text"
+            :size="size"
+            @click.stop="deleteRow(scope.row)"
+            v-if="scope.row.status == 0 || scope.row.status == 3"
+            >删除</el-button
+          >
+          <el-button
+            v-if="
+              scope.row.status == '1' && scope.row.oaId && scope.row.oaId != ''
+            "
+            type="text"
+            :size="size"
+            @click.stop="handleBack(scope.row)"
+            >流程收回</el-button
+          >
+        </template>
+      </ux-table-column>
+    </el-super-ux-table>
+
+    <details-requsition
+      ref="detailsRequsition"
+      :addType="addType"
+      :dict="dict"
+      :size="size"
+      @success="useQuery(params, page)"
+    ></details-requsition>
+  </el-card>
+</template>
+
 <style scoped lang="scss">
-.requisition {
-  // height: calc(100vh - 84px);
-  // padding: 12px;
-  // box-sizing: border-box;
-}
 .el-card {
   width: calc(100% - 32px);
   height: calc(100vh - 32px);

+ 2 - 2
vue.config.js

@@ -37,10 +37,10 @@ module.exports = {
       // detail: https://cli.vuejs.org/config/#devserver-proxy
       [process.env.VUE_APP_BASE_API]: {
         // target: `http://172.16.100.107:8080/drp-admin`, //测试
-        target: `http://test-sy.derom.com/drp-admin`, //测试
+        // target: `http://test-sy.derom.com/drp-admin`, //测试
         // target: `http://release-sy.derom.com/drp-admin`, //预发
         // target: `http://sy.derom.com/drp-admin`, //生产
-        // target: `http://172.16.63.202:8000/drp-admin`, // D本地
+        target: `http://172.16.63.202:8000/drp-admin`, // D本地
         // target: `http://172.16.62.241:8000/drp-admin`, //笑寒本地
         // target: `http://172.16.13.152:8000/drp-admin`, //豪哥本地
         // target: `http://172.16.13.47:8000/drp-admin`, //这是一个美女的本地