Przeglądaj źródła

Merge branch 'dev' into 'purchaseDev'

Dev

See merge request new-business/drp-web!274
黄梓星 1 rok temu
rodzic
commit
98ef163080

+ 8 - 0
src/api/changeApply/basic.js

@@ -62,3 +62,11 @@ export function getProductFactory(data) {
     data: data
   })
 }
+// 获取生产厂家列表信息
+export function getRecordList(params) {
+  return request({
+    url: `/material/record/list`,
+    method: 'get',
+    params: params
+  })
+}

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

@@ -0,0 +1,15 @@
+// 生产厂家
+export default [
+  {
+    key: "code",
+    title: "编码",
+    type: "Input",
+    search: true,
+  },
+  {
+    key: "name",
+    title: "名称",
+    type: "Input",
+    search: true,
+  },
+];

+ 48 - 0
src/components/popover-select/components/MATERIAL_PARAM.js

@@ -45,4 +45,52 @@ export default [
       return prop.materialMedcine.isDrug == "0" ? "Y" : "N";
     },
   },
+  {
+    key: "isDrugNumber",
+    title: "药品",
+    type: "ComputedInput",
+    formatter: (prop) => {
+      return prop.materialMedcine.isDrug;
+    },
+  },
+  {
+    key: "oriRegistrationNo",
+    title: "注册证号/备案凭证编号",
+    type: "ComputedInput",
+    formatter: (prop) => {
+      return prop.materialMedcine.oriRegistrationNo;
+    },
+  },
+  {
+    key: "dosageFrom",
+    title: "剂型",
+    type: "ComputedInput",
+    formatter: (prop) => {
+      return prop.materialMedcine.dosageFrom;
+    },
+  },
+  {
+    key: "dosageFromName",
+    title: "剂型名称",
+    type: "ComputedInput",
+    formatter: (prop) => {
+      return prop.materialMedcine.dosageFromName;
+    },
+  },
+  {
+    key: "curingType",
+    title: "养护类型",
+    type: "ComputedInput",
+    formatter: (prop) => {
+      return prop.materialMedcine.curingType;
+    },
+  },
+  {
+    key: "medicalInstruments",
+    title: "医疗器械",
+    type: "ComputedInput",
+    formatter: (prop) => {
+      return prop.materialMedcine.medicalInstruments;
+    },
+  },
 ];

+ 2 - 2
src/components/popover-tree-select/index.vue

@@ -154,9 +154,9 @@ export default {
         $props: { source, valueKey, dataMapping },
       } = this;
       for (let key in dataMapping) {
-        source[key] = prop[dataMapping[key]];
+        source[key] = prop[0][dataMapping[key]];
       }
-      this.innerValue = prop[valueKey];
+      this.innerValue = prop[0][valueKey];
       this.$emit("update:source", source);
       this.$emit("change", prop, this.$props);
     },

+ 10 - 0
src/components/super-table/index.vue

@@ -65,6 +65,8 @@ export default {
     ElComputedInput: () => import("@/components/computed-input/index.vue"),
     ElPopoverSelectV2: () => import("@/components/popover-select-v2/index.vue"),
     ElComputedInputV2: () => import("@/components/computed-input-v2/index.vue"),
+    ElPopoverTreeSelect: () =>
+      import("@/components/popover-tree-select/index.vue"),
     ButtonHide: () => import("./hide.vue"),
     ButtonFreeze: () => import("./freeze.vue"),
     IconHide: () => import("./once/hide.vue"),
@@ -311,6 +313,14 @@ export default {
               >
               </component>
               <component
+                v-else-if="attr.is === 'el-popover-tree-select'"
+                v-bind="attr"
+                v-model="scope.row[item.key]"
+                :size="$attrs.size"
+                :source.sync="scope.row"
+              >
+              </component>
+              <component
                 v-else-if="attr.is === 'el-select'"
                 v-bind="attr"
                 v-model="scope.row[item.key]"

+ 0 - 825
src/views/material/changeApply/add.vue

@@ -1,825 +0,0 @@
-<template>
-  <div class="apply_add">
-    <el-tabs type="border-card" v-model="tabValue" @tab-click="handleClick">
-      <el-tab-pane label="基本信息" name="first">
-        <el-form :model="basicForm" :rules="basicRules" ref="basic" label-width="170px">
-          <el-row :gutter="20">
-            <el-col :span="8">
-              <el-form-item label="单据编码" prop="code">
-                <el-input disabled v-model="basicForm.code"></el-input>
-              </el-form-item>
-            </el-col>
-            <el-col :span="8">
-              <el-form-item label="所属组织" prop="orgId">
-                <el-input disabled v-model="basicForm.orgId"></el-input>
-              </el-form-item>
-            </el-col>
-            <el-col :span="8">
-              <el-form-item label="物料编码" prop="materialCode">
-                <el-input readonly :disabled="disable" v-model="basicForm.materialCode">
-                  <el-button :disabled="disable" slot="append" icon="el-icon-more" @click="test01"></el-button>
-                </el-input>
-              </el-form-item>
-            </el-col>
-          </el-row>
-          <el-row :gutter="20">
-            <el-col :span="8">
-              <el-form-item label="物料名称" prop="materialName">
-                <el-input :disabled="disable" v-model="basicForm.materialName"></el-input>
-              </el-form-item>
-            </el-col>
-            <el-col :span="8">
-              <el-form-item label="医药物料" prop="medicineMaterial">
-                <el-select v-model="basicForm.medicineMaterial" placeholder="医药物料" clearable :disabled="disable"
-                           @change="controlMedic">
-                  <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"/>
-                </el-select>
-              </el-form-item>
-            </el-col>
-            <el-col :span="8">
-              <el-form-item label="生产许可证" prop="remark">
-                <el-input :disabled="disable" v-model="basicForm.productionPermit"></el-input>
-              </el-form-item>
-            </el-col>
-          </el-row>
-          <el-row :gutter="20">
-            <el-col :span="8">
-              <el-form-item label="规格" prop="specification">
-                <el-input :disabled="disable" v-model="basicForm.specification"></el-input>
-              </el-form-item>
-            </el-col>
-            <el-col :span="8">
-              <el-form-item label="型号" prop="model">
-                <el-input :disabled="disable" v-model="basicForm.model"></el-input>
-              </el-form-item>
-            </el-col>
-            <el-col :span="8">
-              <el-form-item label="生产厂家/代理人" prop="factory">
-                <el-select ref="factoryOrman" v-model="basicForm.factory" placeholder="生产厂家/代理人" clearable
-                           :disabled="disable" @focus="chooseFactory">
-                  <el-option v-for="item in factoryOptions" :key="item.id" :label="item.name" :value="item.id"/>
-                </el-select>
-                <!-- <el-input :disabled="disable" v-model="basicForm.factory">
-                  <el-button :disabled="disable" slot="append" icon="el-icon-more" @click="test02"></el-button>
-                </el-input> -->
-              </el-form-item>
-            </el-col>
-          </el-row>
-          <el-row :gutter="20">
-            <el-col :span="8">
-              <el-form-item label="注册人/上市许可持有人" prop="registrant">
-                <el-input :disabled="disable" v-model="basicForm.registrant"></el-input>
-              </el-form-item>
-            </el-col>
-            <el-col :span="8">
-              <el-form-item label="存储条件" prop="storageConditions">
-                <el-select v-model="basicForm.storageConditions" placeholder="存储条件" clearable :disabled="disable">
-                  <el-option v-for="dict in dict.type.sys_storage_condition" :key="dict.value" :label="dict.label"
-                             :value="dict.value"/>
-                </el-select>
-              </el-form-item>
-            </el-col>
-            <el-col :span="8">
-              <el-form-item label="运输条件" prop="transportCondition">
-                <el-select v-model="basicForm.transportCondition" placeholder="运输条件" clearable :disabled="disable">
-                  <el-option v-for="dict in dict.type.sys_conditions_carriage" :key="dict.value" :label="dict.label"
-                             :value="dict.value"/>
-                </el-select>
-              </el-form-item>
-            </el-col>
-          </el-row>
-          <el-row :gutter="20">
-            <!--            <el-col :span="8">-->
-            <!--              <el-form-item label="交货周期" prop="leadTime">-->
-            <!--                <el-input type="number" min="0" :disabled="disable" v-model="basicForm.leadTime"></el-input>-->
-            <!--              </el-form-item>-->
-            <!--            </el-col>-->
-            <!--            <el-col :span="8">-->
-            <!--              <el-form-item label="业务线" prop="businessLine"-->
-            <!--                            :rules="{ required: isOneClass, message: '骨科、介入、检验、普耗、设备类物料产线必须输入对应的业务线', trigger: 'blur' }">-->
-            <!--                <el-select ref="lines" v-model="basicForm.businessLine" placeholder="请选择" clearable :disabled="disable"-->
-            <!--                           @focus="chooseLine">-->
-            <!--                  <el-option v-for="item in lineOptions" :key="item.id" :label="item.name" :value="item.id"/>-->
-            <!--                </el-select>-->
-            <!--              </el-form-item>-->
-            <!--            </el-col>-->
-            <!--            <el-col :span="8">-->
-            <!--              <el-form-item label="物料分类" prop="materialClassifyId">-->
-            <!--                <el-input readonly :disabled="disable" v-model="basicForm.fourClass">-->
-            <!--                  <el-button :disabled="disable" slot="append" icon="el-icon-more" @click="chooseFourClass"></el-button>-->
-            <!--                </el-input>-->
-            <!--                <el-input v-show="false" readonly :disabled="disable" v-model="basicForm.materialClassifyId"></el-input>-->
-            <!--              </el-form-item>-->
-            <!--            </el-col>-->
-            <el-col :span="8">
-              <el-form-item label="DI码" prop="remark">
-                <el-input :disabled="disable" v-model="basicForm.diCode"></el-input>
-              </el-form-item>
-            </el-col>
-            <el-col :span="8">
-              <el-form-item label="备注" prop="remark">
-                <el-input :disabled="disable" v-model="basicForm.remark"></el-input>
-              </el-form-item>
-            </el-col>
-            <el-col :span="8">
-              <el-form-item label="一级分类" prop="oneClass">
-                <el-input readonly disabled v-model="basicForm.oneClass"></el-input>
-              </el-form-item>
-            </el-col>
-          </el-row>
-          <el-row :gutter="20">
-            <el-col :span="8">
-              <el-form-item label="二级分类" prop="twoClass">
-                <el-input readonly disabled v-model="basicForm.twoClass"></el-input>
-              </el-form-item>
-            </el-col>
-            <el-col :span="8">
-              <el-form-item label="三级分类" prop="threeClass">
-                <el-input readonly disabled v-model="basicForm.threeClass"></el-input>
-              </el-form-item>
-            </el-col>
-            <el-col :span="8">
-              <el-form-item label="四级分类" prop="fourClass">
-                <el-input readonly disabled v-model="basicForm.fourClass">
-                </el-input>
-              </el-form-item>
-            </el-col>
-          </el-row>
-        </el-form>
-      </el-tab-pane>
-
-      <el-tab-pane label="医药属性" name="second">
-        <el-form :model="basicForm2" ref="basic2" label-width="160px">
-          <el-row :gutter="20">
-            <el-col :span="8">
-              <el-form-item label="药品" prop="drug"
-                            :rules="{ required: !isControl, message: '请选择是否药品', trigger: 'blur' }">
-                <el-select v-model="basicForm2.drug" placeholder="请选择" clearable :disabled="disable || isControl">
-                  <el-option v-for="dict in dict.type.sys_medicine" :key="dict.value" :label="dict.label"
-                             :value="dict.value"/>
-                </el-select>
-              </el-form-item>
-            </el-col>
-            <el-col :span="8">
-              <el-form-item label="注册证号/备案凭证编号" prop="registrationNo">
-                <el-input :disabled="disable || isControl" v-model="basicForm2.registrationNo"></el-input>
-              </el-form-item>
-            </el-col>
-            <el-col :span="8">
-              <el-form-item label="医疗器械" prop="medicalDevices">
-                <el-select v-model="basicForm2.medicalDevices" placeholder="请选择" clearable
-                           :disabled="disable || isControl">
-                  <el-option v-for="dict in dict.type.medical_instruments" :key="dict.value" :label="dict.label"
-                             :value="dict.value"/>
-                </el-select>
-              </el-form-item>
-            </el-col>
-          </el-row>
-          <el-row :gutter="20">
-            <el-col :span="8">
-              <el-form-item label="养护类型" prop="maintenanceType">
-                <el-select v-model="basicForm2.maintenanceType" placeholder="请选择" clearable
-                           :disabled="disable || isControl">
-                  <el-option v-for="dict in dict.type.curing_type" :key="dict.value" :label="dict.label"
-                             :value="dict.value"/>
-                </el-select>
-              </el-form-item>
-            </el-col>
-            <el-col :span="8">
-              <el-form-item label="剂型" prop="dosageFrom"
-                            :rules="{ required: !isControl, message: '请选择剂型', trigger: 'blur' }">
-                <el-select ref="doses" v-model="basicForm2.dosageFrom" placeholder="请选择" clearable
-                           :disabled="disable || isControl" @focus="chooseDose">
-                  <el-option v-for="item in doseOptions" :key="item.id" :label="item.name" :value="item.id"/>
-                </el-select>
-              </el-form-item>
-            </el-col>
-          </el-row>
-        </el-form>
-        <!-- <el-row style="margin-bottom: 12px;">
-          <span>物料类别</span>
-        </el-row>
-        <el-row style="margin-bottom: 12px;">
-          <el-button type="primary" size="small" plain @click="addLine">新增</el-button>
-          <el-button type="primary" size="small" plain @click="handleDelete">删除</el-button>
-          <el-button type="primary" size="small" plain @click="testsave">暂存</el-button>
-        </el-row> -->
-        <!-- <el-row>
-          <el-col :span="12">
-            <el-table
-            :data="basicForm2.medicineTypeChanges"
-            class="request-table"
-            @selection-change="handleSelectionChange"
-            >
-              <el-table-column type="selection" width="55" />
-              <el-table-column label="序号" align="center" prop="sort">
-                <template slot-scope="scope">
-                  <el-input v-model="scope.row.sort"></el-input>
-                </template>
-              </el-table-column>
-              <el-table-column label="物料类别" align="center" prop="medicineCode">
-                <template slot-scope="scope">
-                  <el-input v-model="scope.row.medicineCode"></el-input>
-                </template>
-              </el-table-column>
-              <el-table-column label="类别名称" align="center" prop="medicineName">
-                <template slot-scope="scope">
-                  <el-input v-model="scope.row.medicineName"></el-input>
-                </template>
-              </el-table-column>
-            </el-table>
-          </el-col>
-        </el-row> -->
-      </el-tab-pane>
-
-      <el-tab-pane label="修改记录" name="third">
-        <el-table :data="basicForm.changeRecords" class="request-table">
-          <el-table-column label="字段名称" align="center" prop="pageCondtion"/>
-          <el-table-column label="变更前" align="center" prop="beforeChangeValue"/>
-          <el-table-column label="变更后" align="center" prop="afterChangeValue"/>
-        </el-table>
-      </el-tab-pane>
-
-      <el-tab-pane label="单据信息" name="fourth">
-        <el-form :model="basicForm" ref="info" label-width="160px">
-          <el-row :gutter="20">
-            <el-col :span="8">
-              <el-form-item label="申请人" prop="createByName">
-                <el-input disabled v-model="basicForm.createByName"></el-input>
-              </el-form-item>
-            </el-col>
-            <el-col :span="8">
-              <el-form-item label="申请时间" prop="createTime">
-                <el-input disabled v-model="basicForm.createTime"></el-input>
-              </el-form-item>
-            </el-col>
-            <el-col :span="8">
-              <el-form-item label="创建人" prop="createByName">
-                <el-input disabled v-model="basicForm.createByName"></el-input>
-              </el-form-item>
-            </el-col>
-          </el-row>
-          <el-row :gutter="20">
-            <el-col :span="8">
-              <el-form-item label="创建时间" prop="createTime">
-                <el-input disabled v-model="basicForm.createTime"></el-input>
-              </el-form-item>
-            </el-col>
-            <el-col :span="8">
-              <el-form-item label="最后修改人" prop="updateByName">
-                <el-input disabled v-model="basicForm.updateByName"></el-input>
-              </el-form-item>
-            </el-col>
-            <el-col :span="8">
-              <el-form-item label="最后修改时间" prop="updateTime">
-                <el-input disabled v-model="basicForm.updateTime"></el-input>
-              </el-form-item>
-            </el-col>
-          </el-row>
-          <el-row :gutter="20">
-            <!-- <el-col :span="8">
-              <el-form-item label="最后审核人" prop="approver">
-                <el-input disabled v-model="basicForm.approver"></el-input>
-              </el-form-item>
-            </el-col>
-            <el-col :span="8">
-              <el-form-item label="最后审核时间" prop="approvalTime">
-                <el-input disabled v-model="basicForm.approvalTime"></el-input>
-              </el-form-item>
-            </el-col> -->
-            <el-col :span="8">
-              <el-form-item label="单据状态" prop="status">
-                <el-select v-model="basicForm.status" size="small" disabled>
-                  <el-option v-for="item in statusOptions" :key="item.value" :label="item.label" :value="item.value">
-                  </el-option>
-                </el-select>
-                <!-- <el-input disabled v-model="basicForm.status"></el-input> -->
-              </el-form-item>
-            </el-col>
-          </el-row>
-        </el-form>
-      </el-tab-pane>
-    </el-tabs>
-
-    <div class="btn_group">
-      <el-col :span="1.5">
-        <el-button type="primary" size="small" plain @click="save"
-                   v-if="pageStu == 'add' || pageStu == 'edit'">保存
-        </el-button>
-      </el-col>
-      <el-col :span="1.5" style="margin: 0 10px;">
-        <el-button type="primary" size="small" plain @click="submit" v-if="pageStu == 'check' && (row.status == '0' || row.status == '3')">提交</el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button type="primary" size="small" plain @click="back">返回</el-button>
-      </el-col>
-    </div>
-
-    <popDialog ref="contractSelect" @doSubmit="selectionsToInput" :selectData="selectData" :single="true"/>
-
-    <factory ref="factory" @doSubmit="acceptFactory" :selectData="selectData2" :single="true"/>
-
-    <fourClass ref="fourClass" @doSubmit="acceptFourClass" :selectData="selectData3" :single="true"/>
-
-    <dose ref="dose" @doSubmit="acceptDose" :selectData="selectData9" :single="true"/>
-    <serviceline ref="line" @doSubmit="acceptLine" :selectData="selectData8" :single="true"/>
-  </div>
-</template>
-
-<script>
-  import popDialog from '@/components/PopDialog/index.vue'
-  import factory from '@/components/PopDialog/productFactory.vue'
-  import {addChangeList, getMaterialDetails, getChangeDetails, editChangeList} from '@/api/changeApply/basic'
-  import {getDose, getLine} from '@/api/requisition/basic'
-  // 生产厂商/代理人调用用于回显
-  import {getProductFactory} from '@/api/changeApply/basic'
-  // 四级分类
-  import fourClass from '@/components/PopDialog/fourClass.vue'
-  import dose from '@/components/PopDialog/dose.vue'
-  import serviceline from '@/components/PopDialog/serviceline.vue'
-  // 调用物料分类详情接口用于数据回显
-  import {getDetail} from '@/api/classify/basic';
-
-  export default {
-    name: 'applyAdd',
-    dicts: ['sys_storage_condition', 'sys_conditions_carriage', 'sys_medicine', 'medical_instruments', 'curing_type'],
-    components: {
-      popDialog,
-      factory,
-      dose,
-      serviceline,
-      fourClass
-    },
-    props: ['pageStu', 'row', 'disable'],
-    model: {
-      prop: 'isList',
-      event: 'jugislist'
-    },
-    data() {
-      return {
-        factoryOptions: [],
-        // 剂型
-        doseOptions: [],
-        selectData9: [],
-        selectData8: [],
-        tabValue: 'first',
-        isControl: true,
-        // 业务线
-        lineOptions: [],
-        isOneClass: false,
-        basicForm: {
-          code: '',
-          orgId: '德荣集团',
-          // 物料id
-          materialId: '',
-          materialCode: '',
-          materialName: '',
-          materialClassifyId: '',
-          medicineMaterial: '2',
-          oneClass: '',
-          twoClass: '',
-          threeClass: '',
-          fourClass: '',
-          specification: '',
-          model: '',
-          factory: '',
-          registrant: '',
-          storageConditions: '',
-          transportCondition: '',
-          leadTime: '',
-          remark: '',
-          // 修改记录
-          changeRecords: [],
-          // 单据信息字段
-          createBy: '',
-          applicationTime: '',
-          createTime: '',
-          updateBy: '',
-          updateTime: '',
-          approver: '',
-          approvalTime: '',
-          status: '',
-          // 业务线
-          businessLine: '',
-          // 生产许可证/经营许可证/备案号
-          productionPermit: '',
-          // di码
-          diCode: ''
-        },
-        options: [{
-          value: '0',
-          label: '是'
-        }, {
-          value: '2',
-          label: '否'
-        }],
-        statusOptions: [{
-          value: '0', label: '未提交'
-        }, {
-          value: '1', label: '审批中'
-        }, {
-          value: '2', label: '已完成'
-        }, {
-          value: '3', label: '已驳回'
-        },],
-        basicRules: {
-          materialCode: [{required: true, message: '请选择物料编码', trigger: 'blur'}],
-          materialName: [{required: true, message: '请填写物料名称', trigger: 'blur'}],
-          specification: [{required: true, message: '请填写规格', trigger: 'blur'}],
-          // materialClassifyId: [{required: true, message: '请选择物料分类', trigger: 'blur'}],
-          // model: [{required: true, message: '请填写型号', trigger: 'blur'}],
-          factory: [{required: true, message: '请选择生产厂家/代理人', trigger: 'blur'}],
-          registrant: [{required: true, message: '请填写注册人/上市许可持有人', trigger: 'blur'}],
-          storageConditions: [{required: true, message: '请选择存储条件', trigger: 'blur'}],
-          // transportCondition: [{required: true, message: '请选择运输条件', trigger: 'blur'}],
-          // leadTime: [{required: true, message: '请填写交货周期', trigger: 'blur'}],
-        },
-        basicForm2: {
-          drug: '',
-          registrationNo: '',
-          medicalDevices: '',
-          maintenanceType: '',
-          // 剂型
-          dosageFrom: ''
-          // 医药属性子表
-          // medicineTypeChanges:[
-          // ],
-        },
-        // tableList: [],
-        // 子表选中
-        ids: [],
-        // 弹窗
-        name: '',
-        selectData: [],
-        selectData2: [],
-        selectData3: []
-      }
-    },
-    // watch: {
-    //   value: {
-    //     handler (newVal) {
-    //       this.selectData = []
-    //       if (newVal) {
-    //         newVal.split(',').forEach((id) => { // 回显拿数据
-    //           this.contractService.queryById(id).then(({data}) => {
-    //             if (data && data.id !== '') {
-    //               this.selectData.push(data)
-    //             }
-    //           })
-    //         })
-    //       }
-    //     },
-    //     immediate: true,
-    //     deep: false
-    //   },
-    //   selectData: {
-    //     handler (newVal) {
-    //       this.name = newVal.map(contract => contract.contractName).join(',')
-    //     },
-    //     immediate: false,
-    //     deep: false
-    //   }
-    // },
-    mounted() {
-      this.$nextTick(() => {
-        // console.log('页面状态',this.pageStu)
-        if (this.pageStu == 'check') {
-          // alert('详情页面:')
-          console.log('页面状态', this.pageStu)
-          console.log('数据', this.row)
-          this.getDetails(this.row)
-          // 生产厂家代理人用于回显
-          if (this.row.factory) {
-            this.getFactoryDetails(this.row.factory)
-          }
-        } else if (this.pageStu == 'edit') {
-          // alert('修改页面')
-          console.log('页面状态', this.pageStu)
-          console.log('数据', this.row)
-          this.getDetails(this.row)
-          // 控制医药属性是否能够填写
-          if (this.row.medicineMaterial == '0') {
-            this.isControl = false
-          } else {
-            this.isControl = true
-          }
-          // 生产厂家代理人用于回显
-          if (this.row.factory) {
-            this.getFactoryDetails(this.row.factory)
-          }
-        } else if (this.pageStu == 'add') {
-          // alert('新增页面')
-          console.log('页面状态', this.pageStu)
-        }
-      })
-    },
-    methods: {
-      // 剂型显示列表
-      chooseDose() {
-        this.$refs.doses.blur()
-        this.$refs.dose.init()
-      },
-      // 选择剂型-树形
-      acceptDose(selections) {
-        this.doseOptions.push(selections)
-        this.basicForm2.dosageFrom = selections.id
-        this.getDoseDetails(selections.id)
-      },
-      // 剂型回显
-      getDoseDetails(id) {
-        getDose({id: id}).then(res => {
-          console.log('剂型', res)
-          if (res.code === 200) {
-            this.doseOptions = res.data.tableBody
-          }
-        })
-      },
-      // 生产厂家/代理人用于回显
-      getFactoryDetails(id) {
-        getProductFactory({id: id}).then(res => {
-          if (res.code === 200) {
-            this.factoryOptions = res.data.tableBody
-          }
-        })
-      },
-      // 选择是否医药物料时控制医药属性
-      controlMedic(val) {
-        console.log('val', val)
-        if (val == '0') {
-          this.isControl = false
-          // 初始化剂型为其他
-          this.basicForm2.dosageFrom = '0001A11000000000BX7Z'
-          this.getDoseDetails(this.basicForm2.dosageFrom)
-        } else {
-          this.basicForm2.drug = ''
-          this.basicForm2.registrationNo = ''
-          this.basicForm2.medicalDevices = ''
-          this.basicForm2.maintenanceType = ''
-          this.isControl = true
-        }
-      },
-      handleClick(tab, event) {
-        console.log(tab, event);
-        console.log('页面状态', this.pageStu)
-      },
-      // 如果是详情进入,则调用详情接口
-      getDetails(row) {
-        getChangeDetails(row.id).then(res => {
-          if (res.code === 200) {
-            this.basicForm = res.data
-            if (res.data.medicineChange) {
-              this.basicForm2 = res.data.medicineChange
-            }
-            // 剂型回显
-            if (res.data.medicineChange && res.data.medicineChange.dosageFrom) {
-              this.getDoseDetails(res.data.medicineChange.dosageFrom)
-            }
-            // 业务线回显
-            if (res.data.businessLine) {
-              this.getLineDetails(res.data.businessLine)
-            }
-          }
-        })
-      },
-      save() {
-        // alert('保存传status:0')
-        let sparams = {...this.basicForm, ...{status: 0}}
-        sparams.medicineChange = this.basicForm2
-        console.log('保存参数', sparams)
-        this.$refs['basic'].validate((valid) => {
-          if (valid) {
-            this.$refs['basic2'].validate(valid => {
-              if (valid) {
-                this.$modal.loading("保存中...");
-                addChangeList(sparams).then(res => {
-                  if (res.code === 200) {
-                    this.$message({
-                      message: res.msg,
-                      type: 'success'
-                    });
-                    this.$modal.closeLoading();
-                    this.back()
-                  }
-                }).catch(err => {
-                this.$modal.closeLoading();
-                })
-              }
-            })
-          }
-        })
-      },
-      submit() {
-        // alert('提交传status:1')
-        let sparams = {...this.basicForm, ...{status: 1}}
-        sparams.medicineChange = this.basicForm2
-        console.log('提交参数', sparams)
-        this.$refs['basic'].validate((valid) => {
-          if (valid) {
-            this.$refs['basic2'].validate(valid => {
-              if (valid) {
-                this.$modal.loading("提交中...");
-                editChangeList(sparams).then(res => {
-                  if (res.code === 200) {
-                    this.$message({
-                      message: res.msg,
-                      type: 'success'
-                    });
-                    this.$modal.closeLoading();
-                    this.back()
-                  }
-                }).catch(err => {
-                this.$modal.closeLoading();
-                })
-              }
-            })
-          }
-        })
-      },
-      back() {
-        this.$emit('jugislist', true)
-        // let queryParams = {
-        //   pageNum: 1,
-        //   pageSize: 10
-        // }
-        this.$emit('refresh')
-      },
-      // 子表增删行
-      // handleSelectionChange(val) {
-      //   this.ids = val
-      //   console.log('this.ids',this.ids)
-      // },
-      // addLine() {
-      //   //添加行数
-      //   let newValue = {
-      //     sort:'',
-      //     medicineCode: '',
-      //     medicineName: '',
-      //   };
-      //   this.basicForm2.medicineTypeChanges.push(newValue);
-      // },
-      // handleDelete(index) {
-      //   if(this.ids.length == 0) {
-      //     this.$message({
-      //       message: '请选择删除条目',
-      //       type: 'warning'
-      //     });
-      //   } else {
-      //     // console.log('index',index)
-      //     // this.basicForm2.medicineTypeChanges.splice(index, 1);
-      //     this.basicForm2.medicineTypeChanges = this.basicForm2.medicineTypeChanges.filter(item =>
-      //      !this.ids.some(ele =>
-      //      ele.sort == item.sort))
-      //   }
-      // },
-      // testsave() {
-      //   console.log('暂存表格:', this.basicForm2.medicineTypeChanges)
-      //   console.log('暂存表单1', this.basicForm)
-      //   let params = {...this.basicForm, ...this.basicForm2}
-      //   console.log('暂存总表单', params)
-      // },
-      // 设置选中
-      selectionsToInput(selections) {
-        console.log('父组件拿到的:', selections)
-        this.selectData = selections
-        this.$emit('getInfo', this.selectData)
-        getMaterialDetails(selections[0].id).then(res => {
-          console.log('res', res)
-          if (res.code === 200) {
-            let data = res.data.data
-            // 物料id
-            this.basicForm.materialId = data.id
-            // 物料分类Id
-            // this.basicForm.materialClassifyId = data.classifyId
-            this.basicForm.materialCode = data.code
-            this.basicForm.materialName = data.name
-            this.basicForm.medicineMaterial = data.isMedicine
-            this.basicForm.oneClass = data.oneClass
-            this.basicForm.twoClass = data.twoClass
-            this.basicForm.threeClass = data.threeClass
-            this.basicForm.fourClass = data.fourClass
-            this.basicForm.specification = data.specification
-            this.basicForm.model = data.model
-            this.basicForm.factory = data.manufacturerId
-            this.basicForm.registrant = data.registrant
-            this.basicForm.storageConditions = data.storageCondition
-            this.basicForm.transportCondition = data.transportationCondition
-            this.basicForm.leadTime = data.deliveryPeriod
-            this.basicForm.diCode = data.diCode
-            this.basicForm.businessLine = data.businessLine
-            this.basicForm.productionPermit = data.productionPermit
-            if (data.manufacturerId) {
-              this.getFactoryDetails(data.manufacturerId)
-            }
-            if (data.businessLine) {
-              this.getLineDetails(data.businessLine)
-            }
-            if (data.medcines.length !== 0) {
-              this.basicForm2.drug = data.medcines[0].isDrug
-              this.basicForm2.registrationNo = data.medcines[0].registrationNo
-              this.basicForm2.medicalDevices = data.medcines[0].medicalInstruments
-              this.basicForm2.maintenanceType = data.medcines[0].curingType
-              this.basicForm2.dosageFrom = data.medcines[0].dosageFrom
-              if (data.medcines[0].dosageFrom) {
-                this.getDoseDetails(data.medcines[0].dosageFrom)
-              }
-            }
-            // 控制医药属性是否能够填写
-            if (this.basicForm.medicineMaterial == '0') {
-              this.isControl = false
-            } else {
-              this.isControl = true
-            }
-          }
-        })
-      },
-      // selectionsToInput2 (selections) {
-      //   console.log('选择的数据',selections)
-      //   this.basicForm.factory = selections[0].manufactureName
-      // },
-      // 显示列表
-      test01() {
-        console.log('测试点击')
-        this.$refs.contractSelect.init()
-      },
-      // test02() {
-      //   console.log('测试弹窗2');
-      //   this.$refs.contractSelect2.init()
-      // },
-      // 选择生产厂家/代理人
-      acceptFactory(selections) {
-        console.log('选择的数据', selections)
-        this.factoryOptions = selections
-        this.basicForm.factory = selections[0].id
-        this.getFactoryDetails(selections[0].id)
-      },
-      // 生产厂家/代理人显示列表
-      chooseFactory() {
-        this.$refs.factoryOrman.blur()
-        this.$refs.factory.init()
-      },
-      // 选择四级分类
-      acceptFourClass(selections) {
-        console.log('收到的四级分类', selections)
-        this.basicForm.materialClassifyId = selections.id
-        this.getTreeDetails(selections.id)
-      },
-      // 四级分类显示列表
-      chooseFourClass() {
-        this.$refs.fourClass.init(basicForm.materialClassifyId)
-      },
-      // 选择四级分类后需要根据id再次查询一下123级分类
-      getTreeDetails(id) {
-        getDetail(id).then(res => {
-          if (res.code === 200) {
-            this.basicForm.oneClass = res.data.oneClass
-            this.basicForm.twoClass = res.data.twoClass
-            this.basicForm.threeClass = res.data.threeClass
-            this.basicForm.fourClass = res.data.fourClass
-            const classjudge = res.data.oneClass
-            if (classjudge.includes('介入耗材&5') || classjudge.includes('骨科耗材&2') || classjudge.includes('普通耗材&3') || classjudge.includes('医用设备&1') || classjudge.includes('体外诊断&4')) {
-              this.isOneClass = true
-            } else {
-              this.isOneClass = false
-            }
-          }
-        })
-      },
-      // 选择业务线
-      acceptLine(selections) {
-        this.lineOptions = selections
-        this.basicForm.businessLine = selections[0].id
-        this.getLineDetails(selections[0].id)
-      },
-      // 业务线显示列表
-      chooseLine() {
-        this.$refs.lines.blur()
-        this.$refs.line.init()
-      },
-      // 业务线回显
-      getLineDetails(id) {
-        getLine({id: id}).then(res => {
-          console.log('业务线', res)
-          if (res.code === 200) {
-            this.lineOptions = res.data.tableBody
-          }
-        })
-      },
-    }
-  }
-</script>
-
-<style lang="scss" scoped>
-  .apply_add {
-    height: calc(100vh - 84px);
-    padding: 12px;
-    box-sizing: border-box;
-    overflow-y: auto;
-  }
-
-  .btn_group {
-    width: 100%;
-    margin: 20px 0;
-    display: flex;
-    justify-content: center;
-  }
-</style>

+ 399 - 0
src/views/material/changeApply/add/column.js

@@ -0,0 +1,399 @@
+export default function useColumns(){
+
+  const TableColumns = [
+    {
+      item:{
+        key:'code',
+        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:'status',
+        title:'单据状态',
+      },
+      attr:{
+        is: "el-select",
+        dictName: "documents_status", // 字典名
+        disabled:true,
+      },
+    },
+    // {
+    //   item:{
+    //     key:'approver',
+    //     title:'申请人',
+    //   },
+    //   attr:{
+    //     is: "el-input",
+    //     disabled:true,
+    //   },
+      
+    // },
+    {
+      item:{
+        key:'applicationTime',
+        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,
+      },
+  
+    },
+    
+  ].map(({ item, attr }) => ({
+    attr,
+    item: { ...item, hidden: true, span: item.span || 6 },
+  }));
+  
+  const TabColumns = [
+    {
+      item:{
+        key:'materialBasic',
+        title:'物料信息',
+      },
+      attr:{
+        value:[]
+      },
+      TableColumns:[
+        {
+          item:{
+            key:'materialCode',
+            title:'物料编码',
+            require: true,
+          },
+          attr:{
+            is: "el-input",
+            disabled:true,
+          },
+         
+        },
+        {
+          item:{
+            key:'materialName',
+            title:'物料名称',
+            require: true,
+          },
+          attr:{
+            is: "el-popover-select-v2",
+            valueKey: "name",
+            referName: "MATERIAL_PARAM",
+            dataMapping: {
+              materialId: "id",
+              materialCode: "code",
+              materialName: "name",
+              diCode:'diCode',
+              remark:'remark',
+              model: "model",
+              materialClassifyId:'classifyId',
+              productionPermit:'productionPermit',
+              specification: "specification",
+              storageConditions:'storageCondition',
+              transportCondition:'transportationCondition',
+              medicineMaterial:'isMedicine',
+              factory:'manufacturerId',
+              factoryName:'manufacturerIdName',
+              registrant:'registrant',
+              oneClass:'oneClass',
+              twoClass:'twoClass',
+              threeClass:'threeClass',
+              fourClass:'fourClass',
+              drug:'isDrugNumber',
+              registrationNo:'oriRegistrationNo',
+              dosageFrom:'dosageFrom',
+              dosageFromName:'dosageFromName',
+              maintenanceType:'curingType',
+              medicalDevices:'medicalInstruments',
+            },
+
+          },
+         
+        },
+        {
+          item:{
+            key:'medicineMaterial',
+            title:'医药物料',
+          },
+          attr:{
+            is: "el-select",
+            dictName: "sys_number_yes_no", // 字典名
+          },
+         
+        },
+        {
+          item:{
+            key:'productionPermit',
+            title:'生产许可证',
+          },
+          attr:{
+            is: "el-input",
+          },
+          
+        },
+        {
+          item:{
+            key:'specification',
+            title:'规格',
+            require: true,
+          },
+          attr:{
+            is: "el-input",
+          },
+         
+        },
+        {
+          item:{
+            key:'model',
+            title:'型号',
+          },
+          attr:{
+            is: "el-input",
+          },
+         
+        },
+        {
+          item:{
+            key:'factoryName',
+            title:'生产厂家/代理人',
+            require: true,
+          },
+          attr:{
+            is: "el-popover-select-v2",
+            valueKey: "name",
+            referName: "MANUFACTURER_PARAM",
+            dataMapping: {
+              factory:'id'
+            }
+          },
+          
+        },
+        {
+          item:{
+            key:'registrant',
+            title:'注册人/上市许可持有人',
+            require: true,
+          },
+          attr:{
+            is: "el-input",
+          },
+         
+        },
+        {
+          item:{
+            key:'storageConditions',
+            title:'存储条件',
+            require: true,
+          },
+          attr:{
+            is: "el-select",
+            dictName: "sys_storage_condition", // 字典名
+          },
+          
+        },
+        {
+          item:{
+            key:'transportCondition',
+            title:'运输条件',
+          },
+          attr:{
+            is: "el-select",
+            dictName: "sys_conditions_carriage", // 字典名
+          },
+         
+        },
+        {
+          item:{
+            key:'diCode',
+            title:'DI码',
+          },
+          attr:{
+            is: "el-input",
+          },
+         
+        },
+        {
+          item:{
+            key:'remark',
+            title:'备注',
+          },
+          attr:{
+            is: "el-input",
+          },
+         
+        },
+        {
+          item:{
+            key:'oneClass',
+            title:'一级分类',
+          },
+          attr:{
+            is: "el-input",
+            disabled:true,
+          },
+          
+        },
+        {
+          item:{
+            key:'twoClass',
+            title:'二级分类',
+          },
+          attr:{
+            is: "el-input",
+            disabled:true,
+          },
+         
+        },
+        {
+          item:{
+            key:'threeClass',
+            title:'三级分类',
+          },
+          attr:{
+            is: "el-input",
+            disabled:true,
+          },
+          
+        },
+        {
+          item:{
+            key:'fourClass',
+            title:'四级分类',
+          },
+          attr:{
+            is: "el-input",
+            disabled:true,
+          },
+         
+        },
+        {
+          item:{
+            key:'drug',
+            title:'药品',
+          },
+          attr:{
+            is: "el-select",
+            dictName: "sys_medicine", // 字典名
+          },
+         
+        },
+        {
+          item:{
+            key:'registrationNo',
+            title:'注册证号/备案凭证编号',
+          },
+          attr:{
+            is: "el-input",
+          },
+         
+        },
+        {
+          item:{
+            key:'medicalDevices',
+            title:'医疗器械',
+          },
+          attr:{
+            is: "el-select",
+            dictName: "medical_instruments", // 字典名
+          },
+          
+        },
+        {
+          item:{
+            key:'maintenanceType',
+            title:'养护类型',
+          },
+          attr:{
+            is: "el-select",
+            dictName: "curing_type", // 字典名
+          },
+         
+        },
+        {
+          item:{
+            key:'dosageFromName',
+            title:'剂型',
+          },
+          attr:{
+            is: "el-popover-tree-select",
+            referName: "DOSAGEFORM_PARAM",
+            valueKey: "name",
+            dataMapping: {
+              dosageFrom:'id'
+            }
+          },
+          
+        },
+  
+      ]
+    }, 
+  ]
+
+  return {TableColumns,TabColumns}
+}
+

+ 432 - 0
src/views/material/changeApply/add/index.vue

@@ -0,0 +1,432 @@
+<!-- 批量新增 -->
+<script>
+import useColumns from "./column";
+import {addChangeList, getMaterialDetails, getChangeDetails, editChangeList} from '@/api/changeApply/basic';
+
+
+export default {
+  name: "AddChangeOrders",
+  props: {
+    dict: {
+      type: Object,
+    },
+    addType: {
+      type: String,
+      default: "add",
+    },
+  },
+  components: {
+    AmendantRecord: () => import("../amendantRecord/index.vue"),
+    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(){},
+    }
+  
+  },
+  watch: {
+    
+  },
+  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
+        >
+          <el-super-table
+            v-model="materialInfo[item.key]"
+            :dict="dict"
+            :ref="tabName"
+            :columns="columns"
+            :size="$attrs.size"
+          >
+            <template slot="materialName" slot-scope="scope">
+              <component
+                v-bind="scope.attr"
+                v-model="scope.row[scope.item.key]"
+                :size="$attrs.size"
+                :source.sync="scope.row"
+              >
+              </component>
+            </template>
+            <!-- 判断是否禁用 -->
+            <template slot="drug" slot-scope="scope">
+              <component
+                v-bind="scope.attr"
+                v-model="scope.row[scope.item.key]"
+                :size="$attrs.size"
+                :source.sync="scope.row"
+                :disabled="!(scope.row.medicineMaterial ==='0') "
+              >
+              <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="registrationNo" slot-scope="scope">
+              <component
+                v-bind="scope.attr"
+                v-model="scope.row[scope.item.key]"
+                :size="$attrs.size"
+                :source.sync="scope.row"
+                :disabled="!(scope.row.medicineMaterial ==='0') "
+              >
+              </component>
+            </template>
+
+            <template slot="medicalDevices" slot-scope="scope">
+              <component
+                v-bind="scope.attr"
+                v-model="scope.row[scope.item.key]"
+                :size="$attrs.size"
+                :source.sync="scope.row"
+                :disabled="!(scope.row.medicineMaterial ==='0') "
+              >
+              <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="maintenanceType" slot-scope="scope">
+              <component
+                v-bind="scope.attr"
+                v-model="scope.row[scope.item.key]"
+                :size="$attrs.size"
+                :source.sync="scope.row"
+                :disabled="!(scope.row.medicineMaterial ==='0') "
+              >
+              <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="dosageFromName" slot-scope="scope">
+              <component
+                v-bind="scope.attr"
+                v-model="scope.row[scope.item.key]"
+                :size="$attrs.size"
+                :source.sync="scope.row"
+                :disabled="!(scope.row.medicineMaterial ==='0') "
+              >
+              </component>
+            </template>
+            
+
+            <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>
+        </el-tab-pane>
+      </el-tabs>
+
+      
+     
+    </el-drawer>
+</template>
+
+<style scoped>
+::v-deep .el-table__row.is-hidden {
+  display: none;
+}
+</style>
+
+

+ 7 - 0
src/views/material/changeApply/amendantRecord/column.js

@@ -0,0 +1,7 @@
+export const recordColumns = [
+  { item: { key: "pageCondtion", title: "字段名称" }, attr: {} },
+  { item: { key: "afterChangeValue", title: "变更前" }, attr: {} },
+  {
+    item: { key: "beforeChangeValue", title: "变更后" },attr: {},
+  },
+];

+ 102 - 0
src/views/material/changeApply/amendantRecord/index.vue

@@ -0,0 +1,102 @@
+<!-- 修改记录 -->
+<script>
+import {recordColumns} from './column';
+import {getRecordList} from '@/api/changeApply/basic';
+
+export default {
+  name:'AmendantRecord',
+  components:{
+    ElSuperTable: () => import("@/components/super-table/index.vue"),
+  },
+  dicts:[],
+  props:{
+    type:{
+      type:String,
+      default:'text',
+    },
+    value:{
+      type:Object,
+      require:true,
+    },
+    size:{
+      type:String,
+      default:'mini'
+    }
+  },
+  data(){
+
+    return {
+      title:'修改记录',
+      visible:false,
+      loading:false,
+      tableData:[],
+      TableColumns:recordColumns,
+      
+
+    }
+  },
+  methods:{
+    async beforeOpen(){
+      try {
+        let {id} = this.value;
+
+        this.loading = true;
+
+        let {code,rows} = await getRecordList({changeId:id});
+
+        if(code == 200){
+          this.tableData = rows;
+        }
+        
+      } catch (error) {
+        
+      }finally{
+        this.loading = false;
+      }
+    },
+    // 
+    handleClose(){},
+    handleClick(){
+      this.visible = true;
+    },
+  },
+  created(){},
+}
+</script>
+
+<template>
+
+  <el-button 
+    v-bind="$attrs"
+    v-on="$listeners"
+    :type="type"
+    @click="handleClick"
+    :size="size"
+  >
+    {{ title }}
+    <el-drawer
+      :title="title"
+      v-loading="loading"
+      width="50%"
+      @open="beforeOpen"
+      :visible.sync="visible"
+      append-to-body
+      direction="rtl"
+      :size="size"
+    >
+
+      <div style="padding: 10px;">
+
+        <el-super-table
+          v-model="tableData"
+          :dict="dict"
+          :columns="TableColumns"
+          :size="size"
+          >
+        </el-super-table>
+      </div>
+
+    </el-drawer>
+  </el-button>
+
+</template>

+ 128 - 0
src/views/material/changeApply/batchImport/index.vue

@@ -0,0 +1,128 @@
+<script>
+import { importData, fileImport} from '@/api/requisition/basic';
+export default {
+  name:'BatchImport',
+  props:{},
+  data(){
+    return {
+      title:'批量导入',
+      visible:false,
+      fileData:[]
+    }
+  },
+  methods:{
+    beforeColse(){},
+    handleClick(){
+      this.visible = true;
+    },
+    confirmUpdate(){
+  if (this.fileData.length) {
+
+    let formData = new FormData();
+
+    formData.append('file', this.fileData[0].raw);
+    importData(formData).then(res => {
+      if (res.code == 200) {
+        this.visible = false;
+        this.fileData = [];
+        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.$notify({
+          message: res.data.msg,
+          type: res.data.flag ? 'warning' : 'success'
+        });
+      } else {
+        this.$notify({
+          message: res.msg,
+          type: res.code == 200 ? 'success' : 'warning'
+        });
+      }
+    })
+      } else {
+      this.$notify({
+        title:'警告',
+        message: '请上传文件之后在确认!',
+        type: 'warning'
+      });
+      }
+    },
+  
+    handleDownTemplate(){},
+    handleFileRemove(file, fileList) {
+        console.log('删除文件', file, 'file', fileList, 'fileList');
+        this.fileData = fileList;
+      },
+    handleChangeFile(file, fileList){
+      this.fileData = fileList;
+    },
+    cancal(){
+      this.fileData = [];
+      this.visible = false;
+    },
+  },
+  created(){},
+}
+</script>
+
+<template>
+  <el-button
+    v-bind="$attrs"
+    v-on="$listeners"
+    type="primary"
+    @click="handleClick"
+    :size="size"
+  >
+    {{ title }}
+    <el-dialog 
+      :title="title" 
+      :visible.sync="visible"
+      width="35%" 
+      center
+      append-to-body
+      :before-close="beforeColse"
+    >
+      <div>
+        <el-upload 
+          accept=".xls, .xlsx" 
+          ref="upload" 
+          action="#" 
+          :on-remove="handleFileRemove"
+          :file-list="fileData" 
+          :auto-upload="false" 
+          :on-change="handleChangeFile" 
+          :limit="1"
+        >
+          <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
+          <el-button 
+            style="margin-left: 10px;" 
+            size="small" 
+            type="success"
+            @click="handleDownTemplate"
+          >下载模板
+          </el-button>
+          <div slot="tip" class="el-upload__tip">只能上传Excel文件</div>
+        </el-upload>
+
+      </div>
+      <span slot="footer">
+        <el-button @click="cancal">取 消</el-button>
+        <el-button type="primary" @click="confirmUpdate">确 定</el-button>
+      </span>
+    </el-dialog>
+  </el-button>
+</template>

+ 77 - 0
src/views/material/changeApply/columns.js

@@ -0,0 +1,77 @@
+export default function useColumns() {
+
+  const TableColumns = [
+    { item: { key: "orgName", title: "所属组织" }, attr: {} },
+    { item: { key: "code", title: "单据编码" }, attr: {} },
+    {
+      item: { key: "applicationTime", title: "申请时间" },
+      attr: { },
+    },
+    { item: { key: "status", title: "单据状态",width:120, }, 
+      attr: {
+        
+        is: "el-dict-tag",
+        dictName: "documents_status", // 字典名
+      } 
+    },
+    // { item: { key: "materialCode", title: "物料编码" }, attr: {} },
+    // {
+    //   item: { key: "materialName", title: "物料名称" },
+    //   attr: {},
+    // },
+    { item: { key: "approver", title: "最后审批人" }, attr: {} },
+    { item: { key: "approvalTime", title: "最后审核时间" }, attr: {} },
+    { item: { key: "createByName", title: "创建人" ,width:150, }, attr: {} },
+    { item: { key: "createTime", title: "创建时间" }, attr: {} },
+    {
+      item: { key: "updateByName", title: "最后修改人" ,width:150, },
+      attr: {  },
+    },
+    { item: { key: "updateTime", title: "最后修改时间" }, attr: {} },
+   
+  ].map(({ item, attr }) => ({
+    attr,
+    item: { ...item, hidden: true, fixed: false },
+  }));
+
+  const SearchColumns = [
+    {
+      item: { key: "materialCode", title: "物料编码" },
+      attr: {
+        is: "el-popover-select-v2",
+        referName: "MATERIAL_PARAM",
+        valueKey: "code",
+        clearable:true,
+        dataMapping: { 
+          materialName: "name",
+        },
+      },
+    },
+    {
+      item: { key: "materialName", title: "物料名称" },
+      attr: {
+        is: "el-popover-select-v2",
+        referName: "MATERIAL_PARAM",
+        valueKey: "name",
+        clearable:true,
+        dataMapping: { 
+          materialCode: "code",
+        },
+      },
+    },
+    {
+      item: { key: "status", title: "单据状态" },
+      attr: {
+        is: "el-select",
+        dictName: "documents_status",
+        clearable: true,
+      },
+    },
+  
+  ].map(({ item, attr }) => ({
+    attr,
+    item: { ...item, hidden: true, span: item.span || 6 },
+  }));
+
+  return { TableColumns, SearchColumns };
+}

+ 15 - 0
src/views/material/changeApply/dicts.js

@@ -0,0 +1,15 @@
+import { initDicts } from "@/utils/init.js";
+
+const modules = require.context("./add/", true, /column.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);

+ 142 - 239
src/views/material/changeApply/index.vue

@@ -1,278 +1,181 @@
 <template>
-  <div class="changeApply">
-    <div class="applyList" v-if="isList">
-      <el-row :gutter="10" class="mb10">
-          <!-- <el-select size="small" v-model="textValue" placeholder="请选择">
-          <el-option
-            v-for="item in text"
-            :key="item.value"
-            :label="item.label"
-            :value="item.value">
-          </el-option>
-        </el-select>
 
-        <el-select size="small" v-model="ruleValue" placeholder="请选择">
-          <el-option
-            v-for="item in rule"
-            :key="item.value"
-            :label="item.label"
-            :value="item.value">
-          </el-option>
-        </el-select> -->
-        <el-col :span="1.5">
-          <span style="font-size: 14px;margin-right: 5px;">物料编码</span>
-          <el-input
-            v-model="queryParams.materialCode"
-            size="small"
-            placeholder="请输入物料编码查询"
-            clearable
-            style="width: 240px"
-          />
-        </el-col>
+  <el-card 
+    v-loading="loading" 
+    style="width: calc(100% - 24px); height: 100%; margin: 10px;padding: 10px;" 
+    :body-style="{ padding: 0 }"
+  >
 
-        <el-col :span="1.5">
-          <span style="font-size: 14px;margin-right: 5px;">物料名称</span>
-          <el-input
-            v-model="queryParams.materialName"
-            size="small"
-            placeholder="请输入物料名称查询"
-            clearable
-            style="width: 240px"
-          />
-        </el-col>
+    <AddChangeOrders
+      ref="addChangeOrders"
+      :size="size"
+      :dict="dict"
+      :add-type="optionType"
+      @success="useReset"
+    ></AddChangeOrders>
+    <SeeChangeOrders
+      ref="seeChangeOrders"
+      :size="size"
+      :dict="dict"
+      @success="useReset"
+    ></SeeChangeOrders>
 
-        <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>
+    <div>
 
+      <el-super-search
+        v-model="params"
+        :size="size"
+        :dict="dict"
+        :columns="SearchColumns"
+        @reset="useReset"
+        @row-dblclick="useSee"
+        @submit="useQuery(params, page)"
+      ></el-super-search>
+
+      <el-row 
+        :gutter="10" 
+        class="mb10" 
+        type="flex" 
+        justify="end"
+        style="margin-top: 20px;"
+      >
         <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-button type="primary" size="small" @click="newAdd">新增</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 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-card>
-      <el-table 
-        :data="tableList" 
-        class="request-table"
-        fit
-        max-height="680"
-        @selection-change="handleSelectionChange"
+      <el-super-table
+        v-model="tableList"
+        :dict="dict"
+        :columns="TableColumns"
+        :size="size"
+        pagination
+        :page="page"
+        @pagination="useQuery(params, page)"
+        @row-dblclick="useSee"
       >
-        <!-- <el-table-column type="selection" width="55" /> -->
-        <el-table-column label="序号" align="center" type="index" width="50" />
-        <el-table-column label="所属组织" align="center" width="200" prop="orgId" />
-        <el-table-column label="单据编码" align="center" width="200" prop="code" />
-        <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="materialName" />
-        <!-- <el-table-column label="最后审批人" align="center" width="120" prop="approver" />
-        <el-table-column label="最后审核时间" align="center" width="150" prop="approvalTime" /> -->
-        <el-table-column label="创建人" align="center" prop="createByName" />
-        <el-table-column label="创建时间" align="center" width="150" prop="createTime" />
-        <el-table-column label="最后修改人" align="center" width="120" prop="updateByName" />
-        <el-table-column label="最后修改时间" align="center" width="150" prop="updateTime" />
-        <el-table-column
-          fixed="right"
-          label="操作"
-          align="center"
-          width="150"
-          >
+        <el-table-column fixed="right" label="操作" width="150" align="center">
           <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 type="text" size="small" @click="useSee(scope.row)">查看</el-button>
+            <el-button @click="handleEdit(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>
           </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>
-    </el-card>
+      </el-super-table>
     </div>
+</el-card>
 
-    <component :is="isComponent" v-model="isList" :pageStu="page" :disable="disable" :row="rowDetail" @refresh="getList" v-if="!isList"/>
-  </div>
 </template>
 
 <script>
-import addApply from './add.vue';
-import { getChangeList , deleteChangeList} from '@/api/changeApply/basic'
+import { dicts } from "./dicts";
+import { getChangeList , deleteChangeList} from '@/api/changeApply/basic';
+import useColumns from './columns';
 export default {
   name: 'changeApply',
+  dicts:dicts,
   components: {
-    addApply
+    AddChangeOrders:() => import('./add/index.vue'),
+    SeeChangeOrders:() => import('./see/index.vue'),
+    ElSuperTable: () => import("@/components/super-table/index.vue"),
+    ElSuperSearch: () => import("@/components/super-search/index.vue"),
   },
-  data() {
-    return{
+
+  data(){
+    const {TableColumns,SearchColumns} = useColumns();
+    const params = this.$init.params(SearchColumns);
+    return {
+      loading:false,
+      size:'mini',
       tableList: [],
-      queryParams: {
-        materialCode: '',
-        materialName: '',
-        status: '',
-        pageNum: 1,
-        pageSize: 10
-      },
-      options: [{
-        value: 0, label: '未提交'
-      },{
-        value: 1, label: '审批中'
-      },{
-        value: 2, label: '已完成'
-      },{
-        value: 3, label: '已驳回'
-      },],
-      total:0,
-      // isComponent
-      isComponent:'addApply',
-      isList: true,
-      // 页面状态
-      page: '',
-      rowDetail: {},
-      disable: false
+      TableColumns:TableColumns,
+      page: { pageNum: 1, pageSize: 10, total: 0 },
+      params:params,
+      SearchColumns:SearchColumns,
+      optionType:'add',
+
+
     }
   },
-  created() {
+  methods:{
     
-  },
-  mounted() {
-    this.getList(this.queryParams)
-  },
-  methods: {
-    reset() {
-      this.queryParams.materialCode = ''
-      this.queryParams.materialName = ''
-      this.queryParams.pageNum = 1
-      this.queryParams.status = ''
-      this.getList(this.queryParams)
-    },
-    newAdd() {
-      this.isList = false
-      this.isComponent = 'addApply'
-      this.page = 'add'
-      this.disable = false
+    useReset(){
+      this.page.pageNum = 1;
+      this.page.pageSize = 10;
+      this.params = this.$init.params(this.SearchColumns);
+      this.useQuery(this.params, this.page);
     },
-    getList(val) {
-      console.log('val',val)
-      getChangeList(val).then(res => {
-        if (res.code === 200) {
-          this.tableList = res.rows
-          this.total = res.total
-        }
-      })
+    
+    // 
+    openAddChangeOrders(row) {
+    
+      const {setVisible,fetchItem} = this.$refs.addChangeOrders;
+
+      setVisible(true);
+
+      row && fetchItem(row);
     },
-    // 表格内状态栏判断值
-    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 '已驳回'
-      }
+
+    async newAdd(){
+      this.optionType = 'add';
+      await this.openAddChangeOrders();
     },
-    // 
-    handleSelectionChange () {
+
+    async handleEdit(row){  
+      this.optionType = 'edit';
+      await this.openAddChangeOrders(row);
 
     },
-    check(row) {
-      console.log('查看详情', row)
-      this.isList = false
-      this.isComponent = 'addApply'
-      this.page = 'check'
-      this.rowDetail = row
-      this.disable = true
+
+    async useQuery(params,page) {
+      try {
+        this.loading = true;
+        let {code,rows,total} = await getChangeList({...params,...page});
+        if (code === 200) {
+          this.tableList = rows
+          this.page.total = total;
+        }
+      } catch (error) {
+        
+      }finally{
+        this.loading = false;
+      }
     },
-    edit(row) {
-      console.log('修改先加载详情', row)
-      this.isList = false
-      this.isComponent = 'addApply'
-      this.page = 'edit'
-      this.rowDetail = row
-      this.disable = false
+   
+
+    async useSee(row){
+      const {setVisible,fetchItem} = this.$refs.seeChangeOrders;
+      await setVisible(true);
+      await fetchItem(row);
+
     },
-    deleteRow(row) {
+    deleteRow(row){
       this.$confirm('是否删除此条数据?', '提示', {
-          confirmButtonText: '确定',
-          cancelButtonText: '取消',
-          type: 'warning'
-        }).then(() => {
-          deleteChangeList({id: row.id}).then(res => {
-            if(res.code === 200) {
-              this.$message({
-                message: res.msg,
-                type: 'success'
-              });
-              this.getList(this.queryParams)
-            }
-          })
-        }).catch(() => {})
-    },
-    handleSizeChange(val) {
-      console.log(`每页 ${val} 条`);
-      this.queryParams.pageSize = val
-      this.getList(this.queryParams)
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(async() => {
+
+        try {
+          let {code,msg} = await deleteChangeList({id: row.id});
+
+          if(code == 200){
+            this.$notify.success({
+              // title: '成功',
+              message: msg,
+            });
+            await this.useQuery(this.params, this.page);
+          }
+        } catch (error) {}
+      })
     },
-    handleCurrentChange(val) {
-      console.log(`当前页: ${val}`);
-      this.queryParams.pageNum = val
-      this.getList(this.queryParams)
-    }
-  }
+ 
+  },
+  created(){
+    this.useQuery(this.params, this.page);
+  },
 }
-</script>
 
-<style scoped lang="scss">
-.changeApply {
-  height: calc(100vh - 84px);
-  padding: 12px;
-  box-sizing: border-box;
-}
-</style>
+</script>

+ 289 - 0
src/views/material/changeApply/see/index.vue

@@ -0,0 +1,289 @@
+<!-- 批量新增 -->
+<script>
+import useColumns from "../add/column";
+import {addChangeList, getMaterialDetails, getChangeDetails, editChangeList} from '@/api/changeApply/basic';
+
+
+export default {
+  name: "SeeChangeOrders",
+  props: {
+    dict: {
+      type: Object,
+    },
+  },
+  components: {
+    AmendantRecord: () => import("../amendantRecord/index.vue"),
+    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]);
+    let tabColumns = _.cloneDeep(TabColumns);
+    tabColumns =  tabColumns.map(item =>( 
+
+      {...item,
+        TableColumns: [...item.TableColumns.map(column =>({
+          item:{...column.item,disabled:true},
+          attr:{
+            ...column.attr,
+            disabled:true
+          }
+        }))]
+      }
+      )
+
+    )
+
+    console.log(tabColumns,'tabColumns');
+    
+    return {
+      width: "100%",
+      visible: false,
+      loading:false,
+      title:'查看',
+      rules,
+      params,
+      tabName: tabName,
+      TabColumns: tabColumns,
+      TableColumns: TableColumns,
+    };
+  },
+  computed: {
+   
+    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(){},
+    }
+  
+  },
+  watch: {
+    
+  },
+  methods: {
+    setVisible(prop){
+      this.visible = prop;
+    },
+    beforeOpen(){
+    },
+    //
+    async fetchItem(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.tabName = tabName;
+      this.$emit('success');
+      this.params = this.$init.params([...TabColumns, ...TableColumns]);
+    },
+   
+    async handleSubmit(){
+      this.params = {...this.params,status:'1'};
+      console.log(this.params,'this.params');
+      try {
+          this.loading = true;
+          
+          const {code,msg} = await addChangeList(this.params);
+
+          if(code == 200){
+
+            this.hide();
+            this.$notify.success({
+              message: msg,
+            });
+          }
+          
+        } catch (error) {}
+        finally{
+          this.loading = false;
+        }
+    },
+    handleSubmitValidate(prop,cb){
+
+      this.$refs[prop].$refs[prop].validate(async (valid) => {
+        if (valid) {
+          try {
+            this.loading = true;
+
+            await cb();
+            
+          } catch (err) {
+            // catch
+            console.error(err);
+          } finally {
+            // finally
+            this.loading = false;
+          }
+        } else {
+          return false;
+        }
+      });
+    },
+  },
+  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 
+            v-if="params.status === '0' || params.status === '3'"
+            type="primary"
+            :size="$attrs.size" 
+            :loading="loading" 
+            @click="handleSubmit"
+          >
+            提 交
+          </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"
+            @change="changePuOrgName({ ...scope, select: $event })"
+          >
+          </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
+          >
+            <el-super-table
+              v-model="materialInfo[item.key]"
+              :dict="dict"
+              :ref="tabName"
+              :columns="columns"
+              :size="$attrs.size"
+            >
+              <template slot="materialName" slot-scope="scope">
+                <component
+                  v-bind="scope.attr"
+                  v-model="scope.row[scope.item.key]"
+                  :size="$attrs.size"
+                  :source.sync="scope.row"
+                  @change="changeMaterialName(scope)"
+                >
+                </component>
+              </template>
+              <el-table-column fixed="right" label="操作" width="120" align="center">
+                
+                <template slot-scope="scope">
+                  <AmendantRecord
+                    v-if=" tabName ==='materialBasic' "
+                    v-model="scope.row"
+                  ></AmendantRecord>
+                  
+                </template>
+              </el-table-column>
+            </el-super-table>
+          </el-tab-pane>
+        </el-tabs>
+     
+    </el-drawer>
+</template>
+
+<style scoped>
+::v-deep .el-table__row.is-hidden {
+  display: none;
+}
+</style>
+
+