Procházet zdrojové kódy

新增可以使用方向键移动输入框

695593266@qq.com před 11 měsíci
rodič
revize
c8b7b0816d

+ 1 - 0
package.json

@@ -35,6 +35,7 @@
     "vue": "^2.7.10",
     "vue-clipboard2": "^0.3.3",
     "vue-countup-v2": "^4.0.0",
+    "vue-direction-key": "^1.0.5",
     "vue-echarts": "^6.2.3",
     "vue-i18n": "^8.27.2",
     "vue-printjs": "^1.0.0",

+ 1 - 1
src/api/samplemanagement/index.js

@@ -31,7 +31,7 @@ export async function getSampleQWorkOrderIdPage(data) {
 // 详情页面
 
 export async function getById(id) {
-  const res = await request.get(`/qms/sample/getById/` + id, {});
+  const res = await request.get(`/qms/sample/getById/${id}`);
   if (res.data.code == 0) {
     return res.data;
   }

+ 8 - 6
src/main.js

@@ -15,7 +15,8 @@ import HeaderTitle from '@/components/header-title';
 import authSelection from '@/components/authSelection';
 Vue.component('HeaderTitle', HeaderTitle);
 Vue.component('authSelection', authSelection);
-import print from "vue-printjs"
+import print from 'vue-printjs';
+import Direction from 'vue-direction-key';
 
 // // register globally
 import '@/icons';
@@ -37,11 +38,12 @@ Vue.use(EleAdmin, {
 });
 Vue.use(permission);
 Vue.use(VueClipboard);
-Vue.use(print)
+Vue.use(print);
+Vue.use(Direction);
 
 let instance = null;
 
-function render (props = {}) {
+function render(props = {}) {
   const { container, routerBase } = props;
   // const router = new VueRouter({
   //   base: window.__POWERED_BY_QIANKUN__ ? routerBase : process.env.BASE_URL,
@@ -62,11 +64,11 @@ if (!window.__POWERED_BY_QIANKUN__) {
   render();
 }
 
-export async function bootstrap () {
+export async function bootstrap() {
   console.log('[vue] vue app bootstraped');
 }
 
-export async function mount (props) {
+export async function mount(props) {
   console.log('[vue] props from main framework', props);
   Vue.prototype.$portalStore = props.store;
 
@@ -79,7 +81,7 @@ export async function mount (props) {
   render(props);
 }
 
-export async function unmount () {
+export async function unmount() {
   instance.$destroy();
   instance.$el.innerHTML = '';
   instance = null;

+ 26 - 5
src/views/inspectionWork/components/newQualityContentTabs.vue

@@ -185,32 +185,36 @@
                 </template>
                 <template v-else-if="column.prop === 'materielDesignation'">
                   <el-input
-                    :disabled="status == 1"
+                    :disabled="status"
                     v-model="scope.row.materielDesignation"
                     size="mini"
+                    v-direction="{ x: 0, y: scope.$index }"
                   ></el-input>
                 </template>
                 <template v-else-if="column.prop === 'clientCode'">
                   <el-input
-                    :disabled="status == 1"
+                    :disabled="status"
                     v-model="scope.row.clientCode"
                     size="mini"
+                    v-direction="{ x: 1, y: scope.$index }"
                   ></el-input>
                 </template>
                 <template v-else-if="column.prop === 'engrave'">
                   <el-input
-                    :disabled="status == 1"
+                    :disabled="status"
                     v-model="scope.row.engrave"
                     size="mini"
+                    v-direction="{ x: 2, y: scope.$index }"
                   ></el-input>
                 </template>
                 <template v-else-if="column.prop === 'weight'">
                   <el-input
                     type="number"
                     v-model="scope.row.weight"
-                    :disabled="scope.row.status == 1"
+                    :disabled="status"
                     :min="0"
                     @input="inputWeight(scope.row, scope.$index)"
+                    v-direction="{ x: 3, y: scope.$index }"
                     size="mini"
                   ></el-input>
                 </template>
@@ -423,7 +427,7 @@
       form: Object,
       ids: String,
       activeName: String,
-      status: Number
+      status: Boolean
     },
     data() {
       return {
@@ -672,6 +676,23 @@
     },
     created() {
       this.reload({ qualityWorkerId: this.ids });
+      let direction = this.$getDirection();
+
+      direction.on('keyup', function (e, val) {
+        console.log(val);
+        if (e.keyCode == 39) {
+          direction.next();
+        }
+        if (e.keyCode == 37) {
+          direction.previous();
+        }
+        if (e.keyCode == 38) {
+          direction.previousLine();
+        }
+        if (e.keyCode == 40) {
+          direction.nextLine();
+        }
+      });
     },
     methods: {
       async datasource({ page, limit, where }) {

+ 2 - 2
src/views/inspectionWork/edit.vue

@@ -160,7 +160,7 @@
         qualityTimeStart: '',
         isReportProcessProduce: false,
         addStatus: [],
-        statusType: ''
+        statusType: false
       };
     },
     watch: {
@@ -435,7 +435,7 @@
       async getDetail() {
         getById(this.$route.query.id).then((res) => {
           this.form = res.data;
-          this.statusType = this.form.status;
+          this.statusType = this.form.status == 1 ? true : false;
 
           this.isReportProcessProduce =
             this.form.isReportProcessProduce == 1 ? true : false;

+ 54 - 50
src/views/sample/samplemanagement/components/addOrEditSample.vue

@@ -87,7 +87,7 @@
   import dictMixins from '@/mixins/dictMixins';
   import sampleTable from './sampleTable.vue';
   import { getCode } from '@/api/login';
-  import { saveData, updateData } from '@/api/samplemanagement';
+  import { saveData, updateData, getById } from '@/api/samplemanagement';
   export default {
     components: {
       sampleTable
@@ -96,7 +96,6 @@
 
     data() {
       return {
-        imgs: [],
         title: '',
         visible: false,
         type: '',
@@ -104,7 +103,15 @@
         form: {
           pricingWay: [],
           conditionType: '',
-          categoryCode: ''
+          categoryCode: '',
+          sampleCode: '',
+          categoryName: '',
+          batchNo: '',
+          measureUnit: '',
+          weightUnit: '',
+          weight: '',
+          specification: '',
+          modelType: ''
         },
         // form: copyObj(formDef),
         // 提交状态
@@ -131,16 +138,21 @@
       //打开弹出框
       async open(type, row, contactCategoryId) {
         // this.$refs.inventoryTable.resetTable()
-        // this.form.categoryLevelId = contactCategoryId;
+        // this.form.categoryLevelId = contactCategoryId;\
         this.title =
           type === 'add' ? '新增' : type === 'view' ? '详情' : '修改';
         this.type = type;
         this.visible = true;
         this.sampleType = type;
+        if (this.sampleType == 'edit') {
+          await this.getDetial(row.id);
+        } else if (this.sampleType == 'add') {
+          this.resetForm();
+          this.resetTable();
+        }
+        // console.log(row, 'row');
 
-        console.log(row, 'row');
-
-        this.dataList = [...row];
+        // this.dataList = row;
         // if (type == 'add') {
         //   this.isUpdate = false;
         // } else {
@@ -150,7 +162,17 @@
         //   // this.getGoodsById(row.id);
         // }
       },
-      cancel() {},
+
+      async getDetial(id) {
+        console.log(id, 'id');
+        const data = await getById(id).then((res) => {
+          console.log(res, 'res');
+        });
+        console.log(data, 'data');
+      },
+      cancel() {
+        this.handleClose();
+      },
       save(formName) {
         this.$refs[formName].validate((valid) => {
           if (valid) {
@@ -191,43 +213,18 @@
         });
       },
       async changesMainNumberModal(id, data) {
-        // console.log(data.code);
-
-        const newData = {};
-        this.dataList = [];
-        data.sampleCode = await this.getSampleCode();
-
-        console.log(data.sampleCode);
+        this.form.categoryCode = data.categoryCode;
         this.form.sampleCode = data.sampleCode;
-
-        newData.sampleCode = data.sampleCode;
-        newData.categoryCode = data.code;
-        newData.categoryName = data.name;
-        newData.batchNo = data.brandNum;
-        newData.measureUnit = data.measuringUnit;
-        newData.weightUnit = data.weightUnit;
-        newData.weight = data.netWeight;
-        newData.specification = data.specification;
-        newData.modelType = data.modelType;
-
-        this.dataList.push(newData);
-
-        // if (data.measureType == 1) {
-        //   newData.measureUnit = data.measuringUnit;
-        // } else if (data.measureType == 2) {
-        //   newData.measureUnit = data.weightUnit;
-        // } else if (data.measureType == 3) {
-        //   newData.measureUnit = data.weightUnit;
-        // } else if (data.measureType == 4) {
-        // } else if (data.measureType == 5) {
-        // }
-
-        // this.dataList.push(data);
-        // console.log(id, list);
-        // this.form.categoryCode = data.sampleCode;
-      },
-      async getSampleCode() {
-        return await getCode('sample_code');
+        this.form.categoryName = data.categoryName;
+        this.form.batchNo = data.brandNum;
+        this.form.measureUnit = data.measuringUnit;
+        this.form.weightUnit = data.weightUnit;
+        this.form.weight = data.netWeight;
+        this.form.specification = data.specification;
+        this.form.modelType = data.modelType;
+        data.conditionType = this.form.conditionType;
+        // this.form = { ...data };
+        this.dataList.push(data);
       },
 
       handleClose() {
@@ -235,22 +232,29 @@
           this.resetForm();
           this.resetTable();
         });
+        this.visible = false;
       },
 
       resetTable() {
+        console.log('resetTable');
         this.dataList = [];
       },
       resetForm() {
-        // this.form= {
-        //   pricingWay: [],
-        //   conditionType: '',
-        //   categoryCode: ''
-        // },
+        console.log('resetForm');
         this.form = {
           pricingWay: [],
           conditionType: '',
-          categoryCode: ''
+          categoryCode: '',
+          sampleCode: '',
+          categoryName: '',
+          batchNo: '',
+          measureUnit: '',
+          weightUnit: '',
+          weight: '',
+          specification: '',
+          modelType: ''
         };
+        this.sampleType = '';
       }
     }
   };

+ 423 - 222
src/views/sample/samplemanagement/components/edit.vue

@@ -4,14 +4,25 @@
     <el-card shadow="never">
       <header-title>
         <el-button @click="cancel">返回</el-button>
-        <el-button type="primary" @click="submit" :loading="loading">提交</el-button>
+        <el-button type="primary" @click="submit" :loading="loading"
+          >提交</el-button
+        >
       </header-title>
-      <base-info ref="baseInfoRefs" v-if="baseForm" :form="baseForm" :btnType="btnType"></base-info>
-      <ele-pro-table ref="table" :columns="tableColumns" :datasource="datasource" :pageSize="20"
-        :pageSizes="[20, 30, 40, 50, 100]">
+      <base-info
+        ref="baseInfoRefs"
+        v-if="baseForm"
+        :form="baseForm"
+        :btnType="btnType"
+      ></base-info>
+      <ele-pro-table
+        ref="table"
+        :columns="tableColumns"
+        :datasource="datasource"
+        :pageSize="20"
+        :pageSizes="[20, 30, 40, 50, 100]"
+      >
         <!-- 表头工具栏 -->
-        <template v-slot:toolbar>
-        </template>
+        <template v-slot:toolbar> </template>
         <template v-slot:categoryCode="{ row }">
           <el-link type="primary" :underline="false">
             {{ row.categoryCode }}
@@ -22,7 +33,11 @@
         </template>
         <!-- 操作列 -->
         <template v-slot:action="{ row }">
-          <el-link type="primary" :underline="false" @click="handleDispose(row, 'dispose')">
+          <el-link
+            type="primary"
+            :underline="false"
+            @click="handleDispose(row, 'dispose')"
+          >
             处置
           </el-link>
         </template>
@@ -33,244 +48,430 @@
       <!--    </template>-->
       <!--  </ele-modal>-->
     </el-card>
-    <sampleDisposeDialog ref="disposeRef" @handleDisposeConfirm="handleDisposeConfirm"></sampleDisposeDialog>
+    <sampleDisposeDialog
+      ref="disposeRef"
+      @handleDisposeConfirm="handleDisposeConfirm"
+    ></sampleDisposeDialog>
   </div>
 </template>
 
 <script>
-import { getSampleQWorkOrderIdPage, getById, disposeSubmit } from "@/api/samplemanagement";
-import baseInfo from './baseInfo.vue';
-import { finishPageTab } from "@/utils/page-tab-util";
-import sampleDisposeDialog from '@/views/inspectionWork/components/sampleDisposeDialog.vue';
+  import {
+    getSampleQWorkOrderIdPage,
+    getById,
+    disposeSubmit
+  } from '@/api/samplemanagement';
+  import baseInfo from './baseInfo.vue';
+  import { finishPageTab } from '@/utils/page-tab-util';
+  import sampleDisposeDialog from '@/views/inspectionWork/components/sampleDisposeDialog.vue';
 
-export default {
-  components: {
-    baseInfo,
-    sampleDisposeDialog
-  },
-  data() {
-    const defaultForm = function () {
-      return {
+  export default {
+    components: {
+      baseInfo,
+      sampleDisposeDialog
+    },
+    data() {
+      const defaultForm = function () {
+        return {};
       };
-    };
-    return {
-      defaultForm,
-      // 表单数据
-      baseForm: { ...defaultForm() },
-      title: null,
-      btnType: null,
-      visible: false,
-      loading: false,
-      qualityWorkOrderId: '',
-      qualitySampleList: [],
-      tableColumns: [
-        { label: '编码', prop: 'categoryCode', width: '150', align: 'center', showOverflowTooltip: true, slot: 'categoryCode' },
-        { label: '样品编码', prop: 'sampleCode', width: '150', align: 'center', showOverflowTooltip: true, slot: 'sampleCode' },
-        { label: '名称', prop: 'categoryName', width: '150', align: 'center', showOverflowTooltip: true },
-        { label: '批次号', prop: 'batchNo', align: 'center', showOverflowTooltip: true },
-        { label: '发货条码', prop: 'barcodes', align: 'center', showOverflowTooltip: true },
-        { label: '包装编码', prop: 'packageNo', align: 'center', showOverflowTooltip: true },
-        { label: '包装数量', prop: 'packingQuantity', align: 'center', showOverflowTooltip: true },
-        { label: '包装单位', prop: 'packingUnit', align: 'center', showOverflowTooltip: true },
-        { label: '计量数量', prop: 'measureQuantity', align: 'center', showOverflowTooltip: true },
-        { label: '计量单位', prop: 'measureUnit', align: 'center', showOverflowTooltip: true },
-        { label: '物料代号', prop: 'materielDesignation', align: 'center', showOverflowTooltip: true },
-        { label: '客户代号', prop: 'clientCode', align: 'center', showOverflowTooltip: true },
-        { label: '刻码', prop: 'engrave', align: 'center', showOverflowTooltip: true },
-        { label: '仓库', prop: 'warehouseName', align: 'center', showOverflowTooltip: true },
-        { label: '货区', prop: 'areaName', align: 'center', showOverflowTooltip: true },
-        { label: '货架', prop: 'goodsShelfName', align: 'center', showOverflowTooltip: true },
-        { label: '货位', prop: 'goodsAllocationName', align: 'center', showOverflowTooltip: true },
-        { label: '生产日期', prop: 'productionDate', align: 'center', showOverflowTooltip: true },
-        { label: '采购日期', prop: 'purchaseDate', align: 'center', showOverflowTooltip: true },
-        { label: '重量', prop: 'weight', align: 'center', showOverflowTooltip: true, fixed: 'right' },
-        { label: '重量单位', prop: 'weightUnit', align: 'center', showOverflowTooltip: true, fixed: 'right' },
-        {
-          label: '处置状态', prop: 'disposalStatus', align: 'center', showOverflowTooltip: true, fixed: 'right', formatter: (row, column, cellValue) => {
-            return cellValue == 1 ? '返工' : cellValue == 2 ? '返修' : cellValue == 3 ? '报废' : cellValue == 4 ? '降级使用' :
-              cellValue == 5 ? '让步接收' : cellValue == 6 ? '留样' : cellValue == 7 ? '消耗' : cellValue == 8 ? '回用' : '';
-          }
-        },
-        { label: '处置时间', prop: 'disposeTime', align: 'center', showOverflowTooltip: true, fixed: 'right' },
-        {
-          label: '质检状态', prop: 'qualityStatus', align: 'center', showOverflowTooltip: true, fixed: 'right', formatter: (row, column, cellValue) => {
-            return cellValue == 0 ? '未检' : cellValue == 1 ? '已检' : cellValue == 2 ? '待检' : '';
-          }
-        },
-        {
-          label: '质检结果', prop: 'qualityResults', align: 'center', showOverflowTooltip: true, fixed: 'right', formatter: (row, column, cellValue) => {
-            return cellValue == 1 ? '合格' : cellValue == 2 ? '不合格' : '';
+      return {
+        defaultForm,
+        // 表单数据
+        baseForm: { ...defaultForm() },
+        title: null,
+        btnType: null,
+        visible: false,
+        loading: false,
+        qualityWorkOrderId: '',
+        qualitySampleList: [],
+        tableColumns: [
+          {
+            label: '编码',
+            prop: 'categoryCode',
+            width: '150',
+            align: 'center',
+            showOverflowTooltip: true,
+            slot: 'categoryCode'
+          },
+          {
+            label: '样品编码',
+            prop: 'sampleCode',
+            width: '150',
+            align: 'center',
+            showOverflowTooltip: true,
+            slot: 'sampleCode'
+          },
+          {
+            label: '名称',
+            prop: 'categoryName',
+            width: '150',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            label: '批次号',
+            prop: 'batchNo',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            label: '发货条码',
+            prop: 'barcodes',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            label: '包装编码',
+            prop: 'packageNo',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            label: '包装数量',
+            prop: 'packingQuantity',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            label: '包装单位',
+            prop: 'packingUnit',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            label: '计量数量',
+            prop: 'measureQuantity',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            label: '计量单位',
+            prop: 'measureUnit',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            label: '物料代号',
+            prop: 'materielDesignation',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            label: '客户代号',
+            prop: 'clientCode',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            label: '刻码',
+            prop: 'engrave',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            label: '仓库',
+            prop: 'warehouseName',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            label: '货区',
+            prop: 'areaName',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            label: '货架',
+            prop: 'goodsShelfName',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            label: '货位',
+            prop: 'goodsAllocationName',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            label: '生产日期',
+            prop: 'productionDate',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            label: '采购日期',
+            prop: 'purchaseDate',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            label: '重量',
+            prop: 'weight',
+            align: 'center',
+            showOverflowTooltip: true,
+            fixed: 'right'
+          },
+          {
+            label: '重量单位',
+            prop: 'weightUnit',
+            align: 'center',
+            showOverflowTooltip: true,
+            fixed: 'right'
+          },
+          {
+            label: '处置状态',
+            prop: 'disposalStatus',
+            align: 'center',
+            showOverflowTooltip: true,
+            fixed: 'right',
+            formatter: (row, column, cellValue) => {
+              return cellValue == 1
+                ? '返工'
+                : cellValue == 2
+                ? '返修'
+                : cellValue == 3
+                ? '报废'
+                : cellValue == 4
+                ? '降级使用'
+                : cellValue == 5
+                ? '让步接收'
+                : cellValue == 6
+                ? '留样'
+                : cellValue == 7
+                ? '消耗'
+                : cellValue == 8
+                ? '回用'
+                : '';
+            }
+          },
+          {
+            label: '处置时间',
+            prop: 'disposeTime',
+            align: 'center',
+            showOverflowTooltip: true,
+            fixed: 'right'
+          },
+          {
+            label: '质检状态',
+            prop: 'qualityStatus',
+            align: 'center',
+            showOverflowTooltip: true,
+            fixed: 'right',
+            formatter: (row, column, cellValue) => {
+              return cellValue == 0
+                ? '未检'
+                : cellValue == 1
+                ? '已检'
+                : cellValue == 2
+                ? '待检'
+                : '';
+            }
+          },
+          {
+            label: '质检结果',
+            prop: 'qualityResults',
+            align: 'center',
+            showOverflowTooltip: true,
+            fixed: 'right',
+            formatter: (row, column, cellValue) => {
+              return cellValue == 1 ? '合格' : cellValue == 2 ? '不合格' : '';
+            }
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            align: 'center',
+            width: 120,
+            resizable: false,
+            slot: 'action',
+            fixed: 'right'
           }
-        },
-        { columnKey: 'action', label: '操作', align: 'center', width: 120, resizable: false, slot: 'action', fixed: 'right' }
-      ],
-      tableData: [],
-      sampleCode: '',
-
-    };
-  },
-  computed: {
-  },
-  watch: {
-  },
-
-  created() {
-    if (this.$route.query.id) {
-      this.getDetail();
-    }
-    if (this.$route.query.sampleCode) {
-      this.sampleCode = this.$route.query.sampleCode;
-    }
-  },
-  methods: {
-    async datasource({ page, where, limit }) {
-      where.qualityWorkOrderId = this.$route.query.qualityWorkOrderId;
-      const arr = await getSampleQWorkOrderIdPage({
-        ...where,
-        pageNum: page,
-        size: limit
-      });
-      this.tableData = arr.list;
-      console.log(arr, 'arr')
-      return arr.list;
-    },
-    async getDetail() {
-      this.visible = true;
-      this.qualityWorkOrderId = this.$route.query.qualityWorkOrderId;
-      getById(this.$route.query.id).then(res => {
-        this.btnType = this.$route.query.type;
-        console.log(res, 'res.data');
-        this.baseForm = res.data;
-      });
-    },
-    async open(type, row) {
-      this.btnType = type;
-      this.title = type == 'add' ? '新增' : type == 'edit' ? '编辑' : '详情';
-      if (this.btnType != 'add') {
-        this.qualityWorkOrderId = row.qualityWorkOrderId;
-        this.baseForm = JSON.parse(JSON.stringify(row));
-      }
-      this.visible = true;
-    },
-    resetForm() {
-      this.baseForm = { ...this.defaultForm() };
-    },
-    handleClose() {
-      this.resetForm();
-      // this.resetTable();
-      this.visible = false;
-    },
-    cancel() {
-      finishPageTab();
-      this.$router.go(-1);
+        ],
+        tableData: [],
+        sampleCode: ''
+      };
     },
-    async submit() {
-      console.log(this.tableData, '表格');
+    computed: {},
+    watch: {},
 
-      for (let i = 0; i < this.tableData.length; i++) {
-        const disposalStatus = this.tableData[i].disposalStatus;
-        const disposeTime = this.tableData[i].disposeTime;
-        const qualityStatus = this.tableData[i].qualityStatus;
-        if (disposalStatus == null || disposeTime == null) {
-          this.$message.error('请完善处置状态和处置时间!')
-          this.loading = false;
-          return
-        }
-        if (qualityStatus == '2') {
-          this.$message.error('请完善质检状态!')
-          this.loading = false;
-          return
-        }
+    created() {
+      if (this.$route.query.id) {
+        this.getDetail();
       }
-      this.loading = true;
-      let pData = {
-        ...form,
-        qualitySampleUpdatePOList: this.tableData,
+      if (this.$route.query.sampleCode) {
+        this.sampleCode = this.$route.query.sampleCode;
       }
-      disposeSubmit(pData)
-        .then((msg) => {
-          this.loading = false;
-          this.$message.success(msg);
-          this.cancel();
-          this.$emit('done');
-        })
-        .catch((e) => {
-          this.loading = false;
-        });
     },
-    handleDispose(row, type) {
+    methods: {
+      async datasource({ page, where, limit }) {
+        where.qualityWorkOrderId = this.$route.query.qualityWorkOrderId;
+        const arr = await getSampleQWorkOrderIdPage({
+          ...where,
+          pageNum: page,
+          size: limit
+        });
+        this.tableData = arr.list;
+        console.log(arr, 'arr');
+        return arr.list;
+      },
+      async getDetail() {
+        this.visible = true;
+        this.qualityWorkOrderId = this.$route.query.qualityWorkOrderId;
+        getById(this.$route.query.id).then((res) => {
+          this.btnType = this.$route.query.type;
+          console.log(res, 'res.data');
+          this.baseForm = res.data;
+        });
+      },
+      async open(type, row) {
+        this.btnType = type;
+        this.title = type == 'add' ? '新增' : type == 'edit' ? '编辑' : '详情';
+        if (this.btnType != 'add') {
+          this.qualityWorkOrderId = row.qualityWorkOrderId;
+          this.baseForm = JSON.parse(JSON.stringify(row));
+        }
+        this.visible = true;
+      },
+      resetForm() {
+        this.baseForm = { ...this.defaultForm() };
+      },
+      handleClose() {
+        this.resetForm();
+        // this.resetTable();
+        this.visible = false;
+      },
+      cancel() {
+        finishPageTab();
+        this.$router.go(-1);
+      },
+      async submit() {
+        console.log(this.tableData, '表格');
 
-      row.sampleDate = this.getNowTimes();
+        for (let i = 0; i < this.tableData.length; i++) {
+          const disposalStatus = this.tableData[i].disposalStatus;
+          const disposeTime = this.tableData[i].disposeTime;
+          const qualityStatus = this.tableData[i].qualityStatus;
+          if (disposalStatus == null || disposeTime == null) {
+            this.$message.error('请完善处置状态和处置时间!');
+            this.loading = false;
+            return;
+          }
+          if (qualityStatus == '2') {
+            this.$message.error('请完善质检状态!');
+            this.loading = false;
+            return;
+          }
+        }
+        this.loading = true;
+        let pData = {
+          ...form,
+          qualitySampleUpdatePOList: this.tableData
+        };
+        disposeSubmit(pData)
+          .then((msg) => {
+            this.loading = false;
+            this.$message.success(msg);
+            this.cancel();
+            this.$emit('done');
+          })
+          .catch((e) => {
+            this.loading = false;
+          });
+      },
+      handleDispose(row, type) {
+        row.sampleDate = this.getNowTimes();
 
-      row.disposeTime = this.getNowTimes();
+        row.disposeTime = this.getNowTimes();
 
-      console.log(null, row, type, this.$route.query.qualityType)
+        console.log(null, row, type, this.$route.query.qualityType);
 
-      this.$refs.disposeRef.openDispose(null, row, type, this.$route.query.qualityType);
-    },
-    // 处理确认事件
-    handleDisposeConfirm(row, index) {
-      console.log(row, index, '处置确认');
-    },
-    getNowDate() {
-      let date = new Date(),
-        obj = {
-          year: date.getFullYear(), //获取当前月份(0-11,0代表1月)
-          month: date.getMonth() + 1, //获取当前月份(0-11,0代表1月)
-          strDate: date.getDate(), // 获取当前日(1-31)
-          hour: date.getHours(), //获取当前小时(0 ~ 23)
-          minute: date.getMinutes(), //获取当前分钟(0 ~ 59)
-          second: date.getSeconds() //获取当前秒数(0 ~ 59)
-        };
-      Object.keys(obj).forEach((key) => {
-        if (obj[key] < 10) obj[key] = `0${obj[key]}`;
-      });
-      return obj;
-    },
-    getNowTime() {
-      const nowDate = this.getNowDate()
-      return nowDate.year + '-' + nowDate.month + '-' + nowDate.strDate + ' ' + nowDate.hour + ':' + nowDate.minute + ':' + nowDate.second
-    },
-    getNowTimes() {
-      const nowDate = this.getNowDate()
-      return nowDate.year + '-' + nowDate.month + '-' + nowDate.strDate
-    },
-  }
-};
+        this.$refs.disposeRef.openDispose(
+          null,
+          row,
+          type,
+          this.$route.query.qualityType
+        );
+      },
+      // 处理确认事件
+      handleDisposeConfirm(row, index) {
+        console.log(row, index, '处置确认');
+      },
+      getNowDate() {
+        let date = new Date(),
+          obj = {
+            year: date.getFullYear(), //获取当前月份(0-11,0代表1月)
+            month: date.getMonth() + 1, //获取当前月份(0-11,0代表1月)
+            strDate: date.getDate(), // 获取当前日(1-31)
+            hour: date.getHours(), //获取当前小时(0 ~ 23)
+            minute: date.getMinutes(), //获取当前分钟(0 ~ 59)
+            second: date.getSeconds() //获取当前秒数(0 ~ 59)
+          };
+        Object.keys(obj).forEach((key) => {
+          if (obj[key] < 10) obj[key] = `0${obj[key]}`;
+        });
+        return obj;
+      },
+      getNowTime() {
+        const nowDate = this.getNowDate();
+        return (
+          nowDate.year +
+          '-' +
+          nowDate.month +
+          '-' +
+          nowDate.strDate +
+          ' ' +
+          nowDate.hour +
+          ':' +
+          nowDate.minute +
+          ':' +
+          nowDate.second
+        );
+      },
+      getNowTimes() {
+        const nowDate = this.getNowDate();
+        return nowDate.year + '-' + nowDate.month + '-' + nowDate.strDate;
+      }
+    }
+  };
 </script>
 
 <style lang="scss" scoped>
-.location-warp {
-  display: flex;
+  .location-warp {
+    display: flex;
 
-  .detail {
-    margin-left: 10px;
+    .detail {
+      margin-left: 10px;
+    }
   }
-}
 
-:deep(.el-form-item__content .el-input-group__prepend) {
-  background-color: #fff;
-}
+  :deep(.el-form-item__content .el-input-group__prepend) {
+    background-color: #fff;
+  }
 
-:deep(.el-dialog:not(.ele-dialog-form) .el-dialog__body .el-form .el-form-item:last-child) {
-  margin-bottom: 22px;
-}
+  :deep(
+      .el-dialog:not(.ele-dialog-form)
+        .el-dialog__body
+        .el-form
+        .el-form-item:last-child
+    ) {
+    margin-bottom: 22px;
+  }
 
-.add-product {
-  width: 100%;
-  display: flex;
-  align-items: center;
-  justify-content: flex-end;
-  font-size: 30px;
-  color: #1890ff;
-  margin: 10px 0;
-  cursor: pointer;
-}
+  .add-product {
+    width: 100%;
+    display: flex;
+    align-items: center;
+    justify-content: flex-end;
+    font-size: 30px;
+    color: #1890ff;
+    margin: 10px 0;
+    cursor: pointer;
+  }
 
-.el-pagination {
-  padding: 12px 16px;
-  background: #fff;
-  border: 1px solid #ebeef5;
-  border-top: none;
-}
+  .el-pagination {
+    padding: 12px 16px;
+    background: #fff;
+    border: 1px solid #ebeef5;
+    border-top: none;
+  }
 </style>

+ 31 - 21
src/views/sample/samplemanagement/components/sampleTable.vue

@@ -37,6 +37,7 @@
 <script>
   import dictMixins from '@/mixins/dictMixins';
   import EquipmentDialog from './equipmentDialog';
+  import { getCode } from '@/api/login';
   export default {
     mixins: [dictMixins],
     components: {
@@ -44,8 +45,10 @@
     },
 
     props: {
-      dataList: Array,
-      default: []
+      dataList: {
+        type: Array,
+        default: () => []
+      }
     },
     data() {
       return {
@@ -148,30 +151,37 @@
         this.$refs.equipmentRefs.open();
       },
 
-      handleMainChoose(val) {
+      async handleMainChoose(val) {
         console.log(val, '主数据根据来源得到产品');
         if (!val) return;
 
-        this.form.productName = val.name; //名称
-        this.form.productCode = val.code; //编码
-        this.form.specification = val.specification; //规格
-        this.form.modelType = val.modelType; //型号
-        this.form.brandNo = val.brandNum; //牌号
-        this.form.totalWeight = val.totalWeight; //总重量
-        this.form.inspectionStandards = val.inspectionStandards; //检验标准
-        this.form.isConsumable = val.isConsumable; //0 单件 1 批量
-        this.form.productId = val.id;
-        this.form.netWeight = val.netWeight; //净重
-        // console.log(this.form.type)
-        // console.log('----------------->>>>');
-        this.getProductDetails(this.form.productId);
-        this.$emit('changesMainNumberModal', this.form.productNumber, val);
-        // if (this.form.type != 3) {
-        //   this.$emit('getQualityTemplate', val.code);
-        // }
+        const newData = {};
+        this.form.datasource = [];
+        val.sampleCode = await this.getSampleCode();
+
+        newData.sampleCode = val.sampleCode;
+
+        newData.sampleCode = val.sampleCode;
+        newData.categoryId = val.id;
+        newData.categoryCode = val.code;
+        newData.categoryName = val.name;
+        newData.batchNo = val.brandNum;
+        newData.measureUnit = val.measuringUnit;
+        newData.weightUnit = val.weightUnit;
+        newData.weight = val.netWeight;
+        newData.specification = val.specification;
+        newData.modelType = val.modelType;
+
+        this.form.datasource.push(newData);
+
+        this.$emit('changesMainNumberModal', this.form.productNumber, newData);
       },
 
-      getProductDetails(productId) {}
+      getProductDetails(productId) {},
+
+      async getSampleCode() {
+        return await getCode('sample_code');
+      }
     }
   };
 </script>

+ 8 - 3
src/views/sample/samplemanagement/index.vue

@@ -23,7 +23,7 @@
       >
         <!-- 表头工具栏 -->
         <!-- <template v-slot:toolbar> </template> -->
-        <template v-slot:toolbar v-if="activeName == '1'">
+        <template v-slot:toolbar>
           <el-button
             size="small"
             type="primary"
@@ -46,6 +46,7 @@
           <el-link
             type="primary"
             :underline="false"
+            icon="el-icon-edit"
             @click="openEdit('edit', row)"
           >
             修改
@@ -278,8 +279,8 @@
         });
       },
 
-      search(e) {
-        this.reload(e);
+      search(where) {
+        this.reload(where);
       },
 
       reload(where = {}) {
@@ -324,6 +325,10 @@
             this.reload();
           })
           .catch((e) => {});
+      },
+      close() {
+        this.dialogVisible = false;
+        this.sampleType = '';
       }
     }
   };

+ 2 - 2
vue.config.js

@@ -34,9 +34,9 @@ module.exports = {
         // target: 'http://124.71.68.31:50001',
         // target: 'http://192.168.1.107:18086',
         // target: 'http://192.168.1.125:18086',
-        // target: 'http://192.168.1.144:18086',
+        target: 'http://192.168.1.144:18086',
         // target: 'http://192.168.1.30:18086',
-        target: 'http://192.168.1.251:18186',
+        // target: 'http://192.168.1.251:18186',
         // target: 'http://124.71.68.31:50001',
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域
         pathRewrite: {

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 124 - 184
yarn.lock


Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů