yusheng 11 ماه پیش
والد
کامیت
7f3f2afa16

+ 120 - 60
src/views/documentManagement/certificateManagement/components/add-dialog.vue

@@ -1,20 +1,43 @@
 <template>
   <!-- 上传 -->
-  <el-dialog :title="title" :visible.sync="dialogVisible" @close="close" width="60%">
+  <ele-modal
+    :title="title"
+    :visible.sync="dialogVisible"
+    @close="close"
+    width="60%"
+    :maxable="true"
+  >
     <el-form ref="form" :model="form" :rules="rules" label-width="82px">
       <el-row :gutter="15">
         <el-col v-bind="styleResponsive ? { sm: 12 } : { span: 12 }">
           <el-form-item prop="holderType" label="持证类型">
-            <el-select style="width: 100%" v-model="form.holderType" @change="holderTypeChange">
-              <el-option :label="item.label" :value="item.value" v-for="(item, index) in holderTypeOptions" :key="index">
+            <el-select
+              style="width: 100%"
+              v-model="form.holderType"
+              @change="holderTypeChange"
+            >
+              <el-option
+                :label="item.label"
+                :value="item.value"
+                v-for="(item, index) in holderTypeOptions"
+                :key="index"
+              >
               </el-option>
             </el-select>
           </el-form-item>
         </el-col>
         <el-col v-bind="styleResponsive ? { sm: 12 } : { span: 12 }">
           <el-form-item prop="type" label="证件类型">
-            <DictSelection v-model="form.type" dictName="证件类型" v-if="['1'].includes(form.holderType)"></DictSelection>
-            <DictSelection v-model="form.type" dictName="客户/供应商资质类型" v-if="['2','3','4','5','6'].includes(form.holderType)"></DictSelection>
+            <DictSelection
+              v-model="form.type"
+              dictName="证件类型"
+              v-if="['1'].includes(form.holderType)"
+            ></DictSelection>
+            <DictSelection
+              v-model="form.type"
+              dictName="客户/供应商资质类型"
+              v-if="['2', '3', '4', '5', '6'].includes(form.holderType)"
+            ></DictSelection>
           </el-form-item>
         </el-col>
         <el-col v-bind="styleResponsive ? { sm: 12 } : { span: 12 }">
@@ -25,70 +48,111 @@
         <el-col v-bind="styleResponsive ? { sm: 12 } : { span: 12 }">
           <el-form-item label="等级:" prop="level">
             <el-select style="width: 100%" v-model="form.level" filterable>
-              <el-option :label="item.label" :value="item.value" v-for="(item, index) in levelOptions" :key="index">
+              <el-option
+                :label="item.label"
+                :value="item.value"
+                v-for="(item, index) in levelOptions"
+                :key="index"
+              >
               </el-option>
             </el-select>
           </el-form-item>
         </el-col>
         <el-col v-bind="styleResponsive ? { sm: 12 } : { span: 12 }">
           <el-form-item prop="status" label="状态">
-            <DictSelection v-model="form.status" dictName="规则状态"></DictSelection>
+            <DictSelection
+              v-model="form.status"
+              dictName="规则状态"
+            ></DictSelection>
           </el-form-item>
         </el-col>
-  
+
         <el-col v-bind="styleResponsive ? { sm: 12 } : { span: 12 }">
           <el-form-item prop="holder" label="持证对象">
-            <el-input v-if="form.holderType != 2" v-model="form.holder" clearable readonly placeholder="请选择"
-              @click.native="openStaffSelection"></el-input>
-              <ele-tree-select
-                v-if="form.holderType == 2"
-                ref="tree"
-                clearable
-                :data="companyData"
-                label-key="name"
-                value-key="id"
-                default-expand-all
-                v-model="form.holder"
-                @change="handleChange"
-              />
+            <el-input
+              v-if="form.holderType != 2"
+              v-model="form.holder"
+              clearable
+              readonly
+              placeholder="请选择"
+              @click.native="openStaffSelection"
+            ></el-input>
+            <ele-tree-select
+              v-if="form.holderType == 2"
+              ref="tree"
+              clearable
+              :data="companyData"
+              label-key="name"
+              value-key="id"
+              default-expand-all
+              v-model="form.holder"
+              @change="handleChange"
+            />
           </el-form-item>
         </el-col>
         <el-col v-bind="styleResponsive ? { sm: 12 } : { span: 12 }">
           <el-form-item label="颁发时间">
-            <el-date-picker style="width: 100%" v-model="form.enactorTime" type="date"
-              value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择日期">
+            <el-date-picker
+              style="width: 100%"
+              v-model="form.enactorTime"
+              type="date"
+              value-format="yyyy-MM-dd HH:mm:ss"
+              placeholder="选择日期"
+            >
             </el-date-picker>
           </el-form-item>
         </el-col>
         <el-col v-bind="styleResponsive ? { sm: 12 } : { span: 12 }">
           <el-form-item prop="date" label="有效期至">
-            <el-date-picker style="width: 100%" v-model="form.date" type="daterange" range-separator="至"
-              start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss"
-              :default-time="['00:00:00', '23:59:59']">
+            <el-date-picker
+              style="width: 100%"
+              v-model="form.date"
+              type="daterange"
+              range-separator="至"
+              start-placeholder="开始日期"
+              end-placeholder="结束日期"
+              value-format="yyyy-MM-dd HH:mm:ss"
+              :default-time="['00:00:00', '23:59:59']"
+            >
             </el-date-picker>
           </el-form-item>
         </el-col>
         <el-col v-bind="styleResponsive ? { sm: 24 } : { span: 24 }">
           <el-form-item prop="fileObj" label="附件">
-            <fileMain v-model="form.fileObj"  />
+            <fileMain v-model="form.fileObj" />
           </el-form-item>
         </el-col>
         <el-col v-bind="styleResponsive ? { sm: 24 } : { span: 24 }">
           <el-form-item prop="remark" label="备注">
-            <el-input placeholder="请输入" v-model="form.remark" type="textarea" :rows="3" :resize="`none`"></el-input>
+            <el-input
+              placeholder="请输入"
+              v-model="form.remark"
+              type="textarea"
+              :rows="3"
+              :resize="`none`"
+            ></el-input>
           </el-form-item>
         </el-col>
       </el-row>
     </el-form>
-    <staffSelection ref="staffSelection" @confirm="confirmStaffSelection"></staffSelection>
+    <staffSelection
+      ref="staffSelection"
+      @confirm="confirmStaffSelection"
+    ></staffSelection>
     <productTable ref="productTableRef" />
-    <supplierSelection ref="supplierSelectionRef" @confirm="confirmStaffSelection" />
-    <customerSelection ref="customerSelectionRef" @confirm="confirmStaffSelection" />
+    <supplierSelection
+      ref="supplierSelectionRef"
+      @confirm="confirmStaffSelection"
+    />
+    <customerSelection
+      ref="customerSelectionRef"
+      @confirm="confirmStaffSelection"
+    />
     <div slot="footer" class="dialog-footer">
       <el-button size="small" @click="save" type="primary">保 存</el-button>
       <el-button size="small" @click="close">关 闭</el-button>
     </div>
-  </el-dialog>
+  </ele-modal>
 </template>
 
 <script>
@@ -103,15 +167,15 @@
   import { listOrganizations } from '@/api/system/organization';
   import { holderTypeOptions } from '@/enum/dict.js';
   const defaultForm = {
-        code: '',
-        holder: '',
-        holderId: '',
-        type:'',
-        date: [],
-        fileObj: [],
-        holderType: '4',
-        status:1,
-      };
+    code: '',
+    holder: '',
+    holderId: '',
+    type: '',
+    date: [],
+    fileObj: [],
+    holderType: '4',
+    status: 1
+  };
   export default {
     components: {
       staffSelection,
@@ -122,7 +186,6 @@
     },
     //注册组件
     data() {
-
       return {
         dialogVisible: false,
         levelOptions: [
@@ -156,14 +219,12 @@
           status: [
             { required: true, trigger: 'change', message: '请选择状态' }
           ],
-          fileObj: [
-            { required: true, trigger: 'change', message: '请选择' }
-          ],
+          fileObj: [{ required: true, trigger: 'change', message: '请选择' }]
         },
         form: { ...defaultForm },
         title: '新增',
         holderTypeOptions,
-        companyData: [], //公司分类
+        companyData: [] //公司分类
       };
     },
     computed: {
@@ -173,14 +234,14 @@
       }
     },
     created() {
-      this.getCompanyData()
+      this.getCompanyData();
     },
     methods: {
       //选择负责人
       confirmStaffSelection(data) {
         console.log(data);
         this.form.holderId = data.map((item) => item.id).join(',');
-        
+
         this.form.holder = data.map((item) => item.name).join(',');
         this.$forceUpdate();
         console.log(this.form);
@@ -188,7 +249,7 @@
       openStaffSelection() {
         if (this.form.holderType == 1) {
           this.$refs.staffSelection.open([]);
-        } else if (this.form.holderType == 3||this.form.holderType == 6) {
+        } else if (this.form.holderType == 3 || this.form.holderType == 6) {
           this.$refs.supplierSelectionRef.open([]);
         } else if (this.form.holderType == 4) {
           this.$refs.customerSelectionRef.open([]);
@@ -213,20 +274,19 @@
         const data = await getPhotoInfo(id);
         this.form = {
           ...data,
-          type:data.type+'',
+          type: data.type + '',
           date: [data.validityStartTime, data.validityEndTime],
           holderType: data.holderType || '1'
         };
-        
 
-        this.$refs.productTableRef.putTableValue(data.categorys || [])
+        this.$refs.productTableRef.putTableValue(data.categorys || []);
       },
 
       close() {
         this.dialogVisible = false;
         // this.$refs.form.resetFields()
         this.form = { defaultForm };
-        this.$refs.productTableRef.initData()
+        this.$refs.productTableRef.initData();
       },
 
       save() {
@@ -239,9 +299,9 @@
             this.form.validityStartTime = this.form.date[0];
             this.form.validityEndTime = this.form.date[1];
           }
-         
+
           const data = {
-            ...this.form,
+            ...this.form
           };
           delete data.date;
           let productTable = this.$refs.productTableRef.getTableValue();
@@ -264,9 +324,9 @@
         if (e === 2) {
           this.getCompanyData();
         }
-        this.form.holder = ''
-        this.form.holderId = ''
-        this.form.type = ''
+        this.form.holder = '';
+        this.form.holderId = '';
+        this.form.type = '';
       },
 
       //查询公司分类
@@ -282,8 +342,8 @@
 
       //选择公司分类
       handleChange(val) {
-        if (!val) return this.form.processTypeName = ''
-        let node = this.$refs.tree.$refs.tree.getCurrentNode()
+        if (!val) return (this.form.processTypeName = '');
+        let node = this.$refs.tree.$refs.tree.getCurrentNode();
         this.form.holderId = node.id;
       }
     }

+ 258 - 261
src/views/factoryModel/plant/components/edit.vue

@@ -9,7 +9,6 @@
     :close-on-press-escape="false"
     width="1200px"
   >
-
     <el-form ref="form" :model="form" :rules="rules" label-width="120px">
       <el-row>
         <el-col :span="8">
@@ -24,7 +23,6 @@
               v-model="form.code"
               placeholder="请输入"
               :disabled="type === 'edit'"
-
             />
           </el-form-item>
         </el-col>
@@ -101,7 +99,7 @@
           <el-form-item label="负责人:" prop="leaderId">
             <el-select
               v-model="form.leaderId"
-              filterable 
+              filterable
               placeholder="请选择"
               @change="change_principal"
               style="width: 100%"
@@ -163,17 +161,17 @@
             ></el-input>
           </el-form-item>
         </el-col>
-<!--        <el-col :span="8" style="margin-bottom: 12px">-->
-<!--          <el-form-item prop="extInfo.campus" label="归属园院区">-->
-<!--            <el-input-->
-<!--              class="form-ipt"-->
-<!--              size="small"-->
-<!--              style="width: 100%"-->
-<!--              placeholder="请输入"-->
-<!--              v-model="form.extInfo.campus"-->
-<!--            ></el-input>-->
-<!--          </el-form-item>-->
-<!--        </el-col>-->
+        <!--        <el-col :span="8" style="margin-bottom: 12px">-->
+        <!--          <el-form-item prop="extInfo.campus" label="归属园院区">-->
+        <!--            <el-input-->
+        <!--              class="form-ipt"-->
+        <!--              size="small"-->
+        <!--              style="width: 100%"-->
+        <!--              placeholder="请输入"-->
+        <!--              v-model="form.extInfo.campus"-->
+        <!--            ></el-input>-->
+        <!--          </el-form-item>-->
+        <!--        </el-col>-->
         <el-col :span="8" style="margin-bottom: 12px">
           <el-form-item prop="extInfo.coveredArea" label="建筑面积">
             <el-input
@@ -231,7 +229,6 @@
         </el-col>
       </el-row>
       <el-row>
-
         <el-col :span="24" style="margin-bottom: 12px">
           <el-form-item label="备注:" prop="remark">
             <el-input
@@ -255,186 +252,180 @@
 </template>
 
 <script>
-import { saveOrUpdate, listWorkshopByParentId } from '@/api/factoryModel';
-import { getUserPage } from '@/api/system/organization';
-import { cityDataLabel } from 'ele-admin/packages/utils/regions';
-import AreaSelect from "@/views/enterpriseModel/regionalManage/components/area-cascader.vue";
-import {basicAreaPageAPI} from "@/api/regionalManage";
-export default {
-  components: {AreaSelect},
-  props: {
-    options_groupId: {
-      type: Array,
-      default() {
-        return [];
+  import { saveOrUpdate, listWorkshopByParentId } from '@/api/factoryModel';
+  import { getUserPage } from '@/api/system/organization';
+  import { cityDataLabel } from 'ele-admin/packages/utils/regions';
+  import AreaSelect from '@/views/enterpriseModel/regionalManage/components/area-cascader.vue';
+  import { basicAreaPageAPI } from '@/api/regionalManage';
+  export default {
+    components: { AreaSelect },
+    props: {
+      options_groupId: {
+        type: Array,
+        default() {
+          return [];
+        }
+      },
+      options_factory: {
+        type: Array,
+        default() {
+          return [];
+        }
       }
     },
-    options_factory: {
-      type: Array,
-      default() {
-        return [];
+    watch: {
+      options_groupId(nval) {
+        this.toTreeData(nval);
       }
-    }
-  },
-  watch: {
-    options_groupId(nval) {
-      this.toTreeData(nval);
-    }
-  },
-  created() {
-    this.getBasicAreaList();
-  },
-  data() {
-    const defaultForm = {
-      id: '',
-      code: '',
-      name: '',
-      leaderId:'',
-      areaId: '',
-      areaName: '',
-      extInfo: {
-        principalDep: '', // 负责人部门
-        phone: '', // 手机号
-        locationDetail: '', // 详细地址
-        location: [], // 省市区
-        assetCode: '', //房屋资产编码
-        campus: '', //归属园院区
-        coveredArea: '', //建筑面积
-        level: '', //楼层
-        moneyCeiling: '', //已配金额上限
-        useArea: '' // 使用面积
-      },
-      groupId: '',
-      enabled: 1,
-      parentId: '',
-      remark: '',
-      type: 2, //  FACTORY(1, "工厂"), WORKSHOP_PLAN(2, "厂房"), WORKSHOP(3, "车间"), LINE(4, "厂线");
-    };
-    return {
-      defaultForm,
-      // 表单数据
-      form: { ...defaultForm },
-      areaList: [],
-      areaTreeList: [],
-      // 表单验证规则
-      rules: {
-        code: [{ required: true, message: '请输入', trigger: 'blur' }],
-        name: [{ required: true, message: '请输入', trigger: 'blur' }],
-        'extInfo.factoryId': [
-          { required: true, message: '请输入', trigger: 'change' }
-        ],
-        parentId: { required: true, message: '请输入', trigger: 'change' },
-        enabled: { required: true, message: '请输入', trigger: 'change' },
-        'extInfo.principalDep': [
-          { required: true, message: '请输入', trigger: 'change' }
-        ],
-        leaderId: [
-          { required: true, message: '请选择', trigger: 'change' }
-        ],
-        'extInfo.phone': [
-          { min: 11, message: '手机号格式不正确', trigger: 'blur' }
-        ],
-
+    },
+    created() {
+      this.getBasicAreaList();
+    },
+    data() {
+      const defaultForm = {
+        id: '',
+        code: '',
+        name: '',
+        leaderId: '',
+        areaId: '',
+        areaName: '',
+        extInfo: {
+          principalDep: '', // 负责人部门
+          phone: '', // 手机号
+          locationDetail: '', // 详细地址
+          location: [], // 省市区
+          assetCode: '', //房屋资产编码
+          campus: '', //归属园院区
+          coveredArea: '', //建筑面积
+          level: '', //楼层
+          moneyCeiling: '', //已配金额上限
+          useArea: '' // 使用面积
+        },
+        groupId: '',
+        enabled: 1,
+        parentId: '',
+        remark: '',
+        type: 2 //  FACTORY(1, "工厂"), WORKSHOP_PLAN(2, "厂房"), WORKSHOP(3, "车间"), LINE(4, "厂线");
+      };
+      return {
+        defaultForm,
+        // 表单数据
+        form: { ...defaultForm },
+        areaList: [],
+        areaTreeList: [],
+        // 表单验证规则
+        rules: {
+          code: [{ required: true, message: '请输入', trigger: 'blur' }],
+          name: [{ required: true, message: '请输入', trigger: 'blur' }],
+          'extInfo.factoryId': [
+            { required: true, message: '请输入', trigger: 'change' }
+          ],
+          parentId: { required: true, message: '请输入', trigger: 'change' },
+          enabled: { required: true, message: '请输入', trigger: 'change' },
+          'extInfo.principalDep': [
+            { required: true, message: '请输入', trigger: 'change' }
+          ],
+          leaderId: [{ required: true, message: '请选择', trigger: 'change' }],
+          'extInfo.phone': [
+            { min: 11, message: '手机号格式不正确', trigger: 'blur' }
+          ]
 
-        // 'extInfo.assetCode': [
-        //   { required: true, message: '请输入', trigger: 'blur' }
-        // ],
+          // 'extInfo.assetCode': [
+          //   { required: true, message: '请输入', trigger: 'blur' }
+          // ],
 
-        // 'extInfo.campus': [
-        //   { required: true, message: '请输入', trigger: 'blur' }
-        // ],
-        // 'extInfo.coveredArea': [
-        //   { required: true, message: '请输入', trigger: 'blur' }
-        // ],
-        // 'extInfo.level': [
-        //   { required: true, message: '请输入', trigger: 'blur' }
-        // ],
+          // 'extInfo.campus': [
+          //   { required: true, message: '请输入', trigger: 'blur' }
+          // ],
+          // 'extInfo.coveredArea': [
+          //   { required: true, message: '请输入', trigger: 'blur' }
+          // ],
+          // 'extInfo.level': [
+          //   { required: true, message: '请输入', trigger: 'blur' }
+          // ],
 
-        // 'extInfo.moneyCeiling': [
-        //   { required: true, message: '请输入', trigger: 'blur' }
-        // ],
-        // 'extInfo.useArea': [
-        //   { required: true, message: '请输入', trigger: 'blur' }
-        // ]
-      },
-      visible: false,
-      type: '', // add/edit
-      loading: false,
-      options: {
-        principalDep: [],
-        principal: [],
-        workshop: [],
-        enabled: [
-          {
-            label: '生效',
-            value: 1
-          },
-          {
-            label: '未生效',
-            value: 0
-          }
-        ],
-        cityDataLabel
-      }
-    };
-  },
-  computed: {
-    title() {
-      switch (this.type) {
-        case 'add':
-          return '新增厂房';
-          break;
-        case 'edit':
-          return '编辑厂房';
-          break;
-        default:
-          break;
-      }
-    }
-  },
-  methods: {
-    /* 获取区域集合 */
-    async getBasicAreaList() {
-      this.areaList = await basicAreaPageAPI(
-        {
-          pageNum: 1,
-          size: 9999
+          // 'extInfo.moneyCeiling': [
+          //   { required: true, message: '请输入', trigger: 'blur' }
+          // ],
+          // 'extInfo.useArea': [
+          //   { required: true, message: '请输入', trigger: 'blur' }
+          // ]
+        },
+        visible: false,
+        type: '', // add/edit
+        loading: false,
+        options: {
+          principalDep: [],
+          principal: [],
+          workshop: [],
+          enabled: [
+            {
+              label: '生效',
+              value: 1
+            },
+            {
+              label: '未生效',
+              value: 0
+            }
+          ],
+          cityDataLabel
         }
-      )
-      this.areaTreeList = this.$util.toTreeData({
-        data: this.areaList,
-        idField: 'id',
-        parentIdField: 'parentId'
-      });
-
+      };
     },
-    getAreaInfo(nodeInfo) {
-      this.form.areaName = nodeInfo[0]?.pathLabels.join('/') || ''
-      this.form.areaId = this.form.areaId || ''
+    computed: {
+      title() {
+        switch (this.type) {
+          case 'add':
+            return '新增厂房';
+          case 'copy':
+            return '新增厂房';
+          case 'edit':
+            return '编辑厂房';
+          default:
+            break;
+        }
+      }
     },
-    open(type, row) {
-      this.type = type;
-      this.visible = true;
-      if (type == 'edit') {
-        for (const key of Object.keys(this.form)) {
-          if (key !== 'extInfo') {
-            this.form[key] = row[key];
-          } else {
-            for (const el of Object.keys(this.form.extInfo)) {
-              this.form.extInfo[el] = row.extInfo[el];
+    methods: {
+      /* 获取区域集合 */
+      async getBasicAreaList() {
+        this.areaList = await basicAreaPageAPI({
+          pageNum: 1,
+          size: 9999
+        });
+        this.areaTreeList = this.$util.toTreeData({
+          data: this.areaList,
+          idField: 'id',
+          parentIdField: 'parentId'
+        });
+      },
+      getAreaInfo(nodeInfo) {
+        this.form.areaName = nodeInfo[0]?.pathLabels.join('/') || '';
+        this.form.areaId = this.form.areaId || '';
+      },
+      open(type, row) {
+        this.type = type;
+        this.visible = true;
+        if (type == 'edit' || type == 'copy') {
+          for (const key of Object.keys(this.form)) {
+            if (key !== 'extInfo') {
+              this.form[key] = row[key];
+            } else {
+              for (const el of Object.keys(this.form.extInfo)) {
+                this.form.extInfo[el] = row.extInfo[el];
+              }
             }
           }
-        }
-        // 请求下拉数据
-        if (this.form.extInfo.factoryId) {
-          this.getListWorkshopByParentId();
-        }
-        if (this.form.extInfo.principalDep) {
-          this.getUserPage();
-        }
-      }else{
-        this.form = { ...this.defaultForm };
-        const info = {
+          // 请求下拉数据
+          if (this.form.extInfo.factoryId) {
+            this.getListWorkshopByParentId();
+          }
+          if (this.form.extInfo.principalDep) {
+            this.getUserPage();
+          }
+        } else {
+          this.form = { ...this.defaultForm };
+          const info = {
             principalDep: '', // 负责人部门
             phone: '', // 手机号
             locationDetail: '', // 详细地址
@@ -445,88 +436,94 @@ export default {
             level: '', //楼层
             moneyCeiling: '', //已配金额上限
             useArea: '' // 使用面积
+          };
+          this.$set(this.form, 'extInfo', info);
+          this.$refs.form.resetFields();
         }
-         this.$set(this.form,'extInfo',info)
-         this.$refs.form.resetFields();
-      }
-    },
-    /* 保存编辑 */
-    save() {
-      this.$refs.form.validate((valid) => {
-        if (!valid) {
-          return false;
+        if (type == 'copy') {
+          this.form.code = '';
         }
-        this.loading = true;
+      },
+      /* 保存编辑 */
+      save() {
+        this.$refs.form.validate((valid) => {
+          if (!valid) {
+            return false;
+          }
+          this.loading = true;
 
-        if (this.type == 'add') {
-          delete this.form.id;
-        }
-        saveOrUpdate(this.form)
-          .then((msg) => {
-            this.loading = false;
-            this.$message.success(msg);
-            this.handleClose();
-            this.$emit('done');
-          })
-          .catch((e) => {
-            this.loading = false;
-            this.$message.error(e.message);
-          });
-      });
-    },
-    restForm() {
-      this.$refs.form.clearValidate();
-      this.form = { ...this.defaultForm };
-    },
-    handleClose() {
-      this.restForm();
-      this.visible = false;
-    },
-    // 格式化公司数据
-    toTreeData(val) {
-      this.options.principalDep = this.$util.toTreeData({
-        data: val,
-        idField: 'id',
-        parentIdField: 'parentId'
-      });
-    },
-    // 获取人员
-    getUserPage() {
-      if (!this.form.extInfo.principalDep) return this.options.leaderId = []
-      let par = {
-        groupId: this.form.extInfo.principalDep,
-        size: 999
-      };
-      getUserPage(par).then((res) => {
-        this.options.principal = res.list;
-      });
-    },
-    // 选择工厂
-    change_factoryId() {
-      let result = this.options_factory.find((n) => n.id == this.form.parentId);
-      this.form.groupId = result.groupId;
-    },
-    // 选择负责人部门
-    change_principalDep() {
-      this.form.leaderId = '';
-      this.options.principal = [];
-      this.getUserPage();
-    },
-    // 选择负责人
-    change_principal() {
-      let result = this.options.principal.find(
-        (n) => n.id == this.form.leaderId
-      );
-      this.form.extInfo.phone = result.phone;
+          if (this.type != 'edit') {
+            delete this.form.id;
+          }
+          saveOrUpdate(this.form)
+            .then((msg) => {
+              this.loading = false;
+              this.$message.success(msg);
+              this.handleClose();
+              this.$emit('done');
+            })
+            .catch((e) => {
+              this.loading = false;
+              this.$message.error(e.message);
+            });
+        });
+      },
+      restForm() {
+        this.$refs.form.clearValidate();
+        this.form = { ...this.defaultForm };
+      },
+      handleClose() {
+        this.restForm();
+        this.visible = false;
+      },
+      // 格式化公司数据
+      toTreeData(val) {
+        this.options.principalDep = this.$util.toTreeData({
+          data: val,
+          idField: 'id',
+          parentIdField: 'parentId'
+        });
+      },
+      // 获取人员
+      getUserPage() {
+        if (!this.form.extInfo.principalDep)
+          return (this.options.leaderId = []);
+        let par = {
+          groupId: this.form.extInfo.principalDep,
+          size: 999
+        };
+        getUserPage(par).then((res) => {
+          this.options.principal = res.list;
+        });
+      },
+      // 选择工厂
+      change_factoryId() {
+        let result = this.options_factory.find(
+          (n) => n.id == this.form.parentId
+        );
+        this.form.groupId = result.groupId;
+      },
+      // 选择负责人部门
+      change_principalDep() {
+        this.form.leaderId = '';
+        this.options.principal = [];
+        this.getUserPage();
+      },
+      // 选择负责人
+      change_principal() {
+        let result = this.options.principal.find(
+          (n) => n.id == this.form.leaderId
+        );
+        this.form.extInfo.phone = result.phone;
+      }
     }
-  }
-};
+  };
 </script>
 <style lang="scss" scoped>
-.location-warp {
-  display: flex;
-  .detail {
-    margin-left: 10px;
+  .location-warp {
+    display: flex;
+    .detail {
+      margin-left: 10px;
+    }
   }
-}
 </style>

+ 9 - 0
src/views/factoryModel/plant/index.vue

@@ -43,6 +43,15 @@
         </template>
         <!-- 操作列 -->
         <template v-slot:action="{ row }">
+          <el-link
+            type="primary"
+            :underline="false"
+            icon="el-icon-edit"
+            @click="openEdit('copy', row)"
+            v-if="$hasPermission('main:factoryarea:saveOrUpdate')"
+          >
+            复制
+          </el-link>
           <el-link
             type="primary"
             :underline="false"

+ 18 - 17
src/views/factoryModel/productionLine/components/edit.vue

@@ -85,7 +85,6 @@
               </el-select>
             </el-form-item>
           </el-col>
-       
 
           {{ options.worksho }}
           <el-col :span="8" style="margin-bottom: 12px">
@@ -399,7 +398,9 @@
         rules: {
           code: [{ required: true, message: '请输入', trigger: 'blur' }],
           name: [{ required: true, message: '请输入', trigger: 'blur' }],
-          workshopPlanId: [{ required: true, message: '请输入', trigger: 'change' }],
+          workshopPlanId: [
+            { required: true, message: '请输入', trigger: 'change' }
+          ],
           factoryId: [{ required: true, message: '请输入', trigger: 'change' }],
           parentId: { required: true, message: '请输入', trigger: 'change' },
           'extInfo.principalDep': [
@@ -442,10 +443,10 @@
         switch (this.type) {
           case 'add':
             return '新增产线';
-            break;
+          case 'copy':
+            return '新增产线';
           case 'edit':
             return '编辑产线';
-            break;
           default:
             break;
         }
@@ -492,7 +493,7 @@
       open(type, row) {
         this.type = type;
         this.visible = true;
-        if (type == 'edit') {
+        if (type == 'edit' || type == 'copy') {
           for (const key of Object.keys(this.form)) {
             if (key !== 'extInfo') {
               this.form[key] = row[key];
@@ -530,22 +531,22 @@
             this.$refs.form.resetFields();
           });
         }
+        if (type == 'copy') {
+          this.form.code = '';
+        }
       },
       /* 获取区域集合 */
       async getBasicAreaList() {
-      this.areaList = await basicAreaPageAPI(
-        {
+        this.areaList = await basicAreaPageAPI({
           pageNum: 1,
           size: 9999
-        }
-      )
-      this.areaTreeList = this.$util.toTreeData({
-        data: this.areaList,
-        idField: 'id',
-        parentIdField: 'parentId'
-      });
-
-    },
+        });
+        this.areaTreeList = this.$util.toTreeData({
+          data: this.areaList,
+          idField: 'id',
+          parentIdField: 'parentId'
+        });
+      },
       getAreaInfo(nodeInfo) {
         this.form.areaName = nodeInfo[0]?.pathLabels.join('/') || '';
         this.form.areaId = this.form.areaId || '';
@@ -558,7 +559,7 @@
           }
           this.loading = true;
 
-          if (this.type == 'add') {
+          if (this.type != 'edit') {
             delete this.form.id;
           }
           let params = deepClone(this.form);

+ 184 - 163
src/views/factoryModel/productionLine/index.vue

@@ -1,7 +1,12 @@
 <template>
   <div class="ele-body">
     <el-card shadow="never">
-      <search ref="search" @search="search" :options_groupId="dict.groupId" :options_factory="dict.factory"></search>
+      <search
+        ref="search"
+        @search="search"
+        :options_groupId="dict.groupId"
+        :options_factory="dict.factory"
+      ></search>
       <ele-pro-table
         ref="table"
         :columns="columns"
@@ -13,32 +18,47 @@
       >
         <!-- 表头工具栏 -->
         <template v-slot:toolbar>
-          <el-button size="small" type="primary" icon="el-icon-plus" class="ele-btn-icon" @click="openEdit('add')"
-          v-if="$hasPermission('main:factoryarea:saveOrUpdate')"
+          <el-button
+            size="small"
+            type="primary"
+            icon="el-icon-plus"
+            class="ele-btn-icon"
+            @click="openEdit('add')"
+            v-if="$hasPermission('main:factoryarea:saveOrUpdate')"
           >
             添加
           </el-button>
         </template>
-    
-
-      
-    
-
 
         <template v-slot:enabled="{ row }">
           {{ dict.enabled[row.enabled] }}
         </template>
         <!-- 操作列 -->
         <template v-slot:action="{ row }">
-          <el-link type="primary" :underline="false" icon="el-icon-edit" @click="openEdit('edit', row)"
-          v-if="$hasPermission('main:factoryarea:saveOrUpdate')"
-          
+          <el-link
+            type="primary"
+            :underline="false"
+            icon="el-icon-edit"
+            @click="openEdit('copy', row)"
+            v-if="$hasPermission('main:factoryarea:saveOrUpdate')"
+          >
+            复制
+          </el-link>
+
+          <el-link
+            type="primary"
+            :underline="false"
+            icon="el-icon-edit"
+            @click="openEdit('edit', row)"
+            v-if="$hasPermission('main:factoryarea:saveOrUpdate')"
           >
             修改
           </el-link>
-          <el-popconfirm class="ele-action" title="确定要删除此角色吗?" @confirm="remove(row)"
-          v-if="$hasPermission('main:factoryarea:delete')"
-          
+          <el-popconfirm
+            class="ele-action"
+            title="确定要删除此角色吗?"
+            @confirm="remove(row)"
+            v-if="$hasPermission('main:factoryarea:delete')"
           >
             <template v-slot:reference>
               <el-link type="danger" :underline="false" icon="el-icon-delete">
@@ -49,171 +69,172 @@
         </template>
       </ele-pro-table>
     </el-card>
-    <edit ref="edit" @done="done" :options_groupId="dict.groupId" :options_factory="dict.factory"></edit>
+    <edit
+      ref="edit"
+      @done="done"
+      :options_groupId="dict.groupId"
+      :options_factory="dict.factory"
+    ></edit>
   </div>
 </template>
 <script>
-import tabMixins from '@/mixins/tableColumnsMixin';
-
-import search from './components/search.vue';
-import edit from './components/edit.vue';
-import { getFactoryarea, deletefactoryarea } from '@/api/factoryModel';
-import { listOrganizations } from '@/api/system/organization';
-export default {
-  mixins: [tabMixins],
-  components: {
-    search,
-    edit
-  },
-  data() {
-    return {
-      columns: [
-        {
-          width: 45,
-          type: 'index',
-          columnKey: 'index',
-          align: 'center'
-        },
-        {
-          prop: 'code',
-          label: '产线编码'
-        },
-        {
-          label: '产线名称',
-          prop: 'name'
-        },
-
-        {
-          label: '所属工厂',
-          prop: 'factoryName',
-         
-        },
+  import tabMixins from '@/mixins/tableColumnsMixin';
 
-        {
-          label: '所属厂房',
-          prop: 'workshopPlanName',
- 
-        },
+  import search from './components/search.vue';
+  import edit from './components/edit.vue';
+  import { getFactoryarea, deletefactoryarea } from '@/api/factoryModel';
+  import { listOrganizations } from '@/api/system/organization';
+  export default {
+    mixins: [tabMixins],
+    components: {
+      search,
+      edit
+    },
+    data() {
+      return {
+        columns: [
+          {
+            width: 45,
+            type: 'index',
+            columnKey: 'index',
+            align: 'center'
+          },
+          {
+            prop: 'code',
+            label: '产线编码'
+          },
+          {
+            label: '产线名称',
+            prop: 'name'
+          },
 
-        {
-          label: '所属车间',
-          prop: 'workshopName',
-        },
+          {
+            label: '所属工厂',
+            prop: 'factoryName'
+          },
 
+          {
+            label: '所属厂房',
+            prop: 'workshopPlanName'
+          },
 
-        {
-          label: '所属区域',
-          prop: 'areaName',
-        },
-     
+          {
+            label: '所属车间',
+            prop: 'workshopName'
+          },
 
+          {
+            label: '所属区域',
+            prop: 'areaName'
+          },
 
-        {
-          label: '省/市/区',
-          prop: 'extInfo.location'
-        },
-        {
-          label: '详细地址',
-          prop: 'extInfo.locationDetail'
-        },
-        {//修改此prop名称时,请同步修改columnKey属性和下方selectType方法
-          label: '状态',
-          prop: 'enabled',
-          slot: 'enabled',
-          filters: [
+          {
+            label: '省/市/区',
+            prop: 'extInfo.location'
+          },
+          {
+            label: '详细地址',
+            prop: 'extInfo.locationDetail'
+          },
+          {
+            //修改此prop名称时,请同步修改columnKey属性和下方selectType方法
+            label: '状态',
+            prop: 'enabled',
+            slot: 'enabled',
+            filters: [
               { value: 1, text: '生效' },
-              { value: 0, text: '未生效' },
+              { value: 0, text: '未生效' }
             ],
-          filterMultiple: false,
-          columnKey: 'enabled'
+            filterMultiple: false,
+            columnKey: 'enabled'
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 220,
+            align: 'center',
+            resizable: false,
+            slot: 'action',
+            showOverflowTooltip: true
+          }
+        ],
+        dict: {
+          groupId: [],
+          factory: [],
+          enabled: {
+            1: '生效',
+            0: '未生效'
+          }
         },
-        {
-          columnKey: 'action',
-          label: '操作',
-          width: 220,
-          align: 'center',
-          resizable: false,
-          slot: 'action',
-          showOverflowTooltip: true
-        }
-      ],
-      dict: {
-        groupId: [],
-        factory: [],
-        enabled: {
-          1: '生效',
-          0: '未生效'
-        }
-      },
-      pageSize: this.$store.state.tablePageSize,
-      cacheKeyUrl: '015ef54f-factoryModel-productionLine'
-    };
-  },
-  created() {
-    this.getGs();
-    this.getFactoryarea();
-  },
-  methods: {
-    selectType(value) {
-      let where = {}
-      if (value.enabled.length > 0) {
-        where['enable'] = value.enabled[0]
-      }
-      this.search(where)
-    },
-    datasource({ page, where, limit }) {
-      return getFactoryarea({
-        ...where,
-        pageNum: page,
-        size: limit,
-        type: 4
-      });
+        pageSize: this.$store.state.tablePageSize,
+        cacheKeyUrl: '015ef54f-factoryModel-productionLine'
+      };
     },
-    search(where) {
-      this.$refs.table.reload({
-        where: where,
-        page: 1
-      });
+    created() {
+      this.getGs();
+      this.getFactoryarea();
     },
-    openEdit(type, row) {
-      if (row) {
-        if (typeof row.mainFactoryCapacityList == 'string') {
-          this.$set(row, 'mainFactoryCapacityList', [])
+    methods: {
+      selectType(value) {
+        let where = {};
+        if (value.enabled.length > 0) {
+          where['enable'] = value.enabled[0];
         }
-      }
-      this.$refs.edit.open(type, row);
-    },
-    // 获取公司数据
-    getGs() {
-      listOrganizations().then((list) => {
-        console.log(list);
-        this.dict.groupId = list;
-      });
-    },
+        this.search(where);
+      },
+      datasource({ page, where, limit }) {
+        return getFactoryarea({
+          ...where,
+          pageNum: page,
+          size: limit,
+          type: 4
+        });
+      },
+      search(where) {
+        this.$refs.table.reload({
+          where: where,
+          page: 1
+        });
+      },
+      openEdit(type, row) {
+        if (row) {
+          if (typeof row.mainFactoryCapacityList == 'string') {
+            this.$set(row, 'mainFactoryCapacityList', []);
+          }
+        }
+        this.$refs.edit.open(type, row);
+      },
+      // 获取公司数据
+      getGs() {
+        listOrganizations().then((list) => {
+          console.log(list);
+          this.dict.groupId = list;
+        });
+      },
 
-    // 获取工厂数据
-    getFactoryarea() {
-      let par = {
-        type: 2,
-        size: 9999
-      };
-      getFactoryarea(par).then((res) => {
-        this.dict.factory = res.list;
-      });
-    },
-    remove(row) {
-      deletefactoryarea(row.id)
-        .then((message) => {
-          this.$message.success(message);
-          this.done();
-        })
-        .catch((e) => {
-          this.$message.error(e.message);
+      // 获取工厂数据
+      getFactoryarea() {
+        let par = {
+          type: 2,
+          size: 9999
+        };
+        getFactoryarea(par).then((res) => {
+          this.dict.factory = res.list;
         });
-    },
-    done() {
-      this.$refs.search.search();
+      },
+      remove(row) {
+        deletefactoryarea(row.id)
+          .then((message) => {
+            this.$message.success(message);
+            this.done();
+          })
+          .catch((e) => {
+            this.$message.error(e.message);
+          });
+      },
+      done() {
+        this.$refs.search.search();
+      }
     }
-  }
-};
+  };
 </script>

+ 21 - 27
src/views/factoryModel/station/components/edit.vue

@@ -41,10 +41,7 @@
 
           <el-col :span="8">
             <el-form-item label="工位类型:" prop="extInfo.type">
-              <el-select
-                class="ele-fluid"
-                v-model="form.extInfo.type"
-              >
+              <el-select class="ele-fluid" v-model="form.extInfo.type">
                 <el-option
                   label="设备"
                   :value="1"
@@ -62,8 +59,6 @@
             </el-form-item>
           </el-col>
 
-          
-
           <el-col :span="8">
             <el-form-item
               label="设备编码:"
@@ -78,8 +73,6 @@
             </el-form-item>
           </el-col>
 
-
-
           <el-col :span="8">
             <el-form-item
               label="设备名称:"
@@ -90,12 +83,10 @@
             </el-form-item>
           </el-col>
 
-
           <el-col :span="8">
             <el-form-item
               label="班组:"
               prop="extInfo.teamId"
-
               v-if="form.extInfo.type == 3"
             >
               <el-select
@@ -123,9 +114,7 @@
               <el-select
                 style="width: 100%"
                 v-model="form.extInfo.userIds"
-           
                 multiple
-              
               >
                 <el-option
                   v-for="item in userList"
@@ -136,7 +125,7 @@
               </el-select>
             </el-form-item>
           </el-col>
-   
+
           <el-col :span="8">
             <el-form-item label="所属区域:" prop="location_city">
               <area-select
@@ -285,7 +274,6 @@
               </el-select>
             </el-form-item>
           </el-col>
-          
 
           <el-col :span="8">
             <el-form-item label="状态:" prop="enabled">
@@ -403,7 +391,7 @@
 
   import { getFactoryarea } from '@/api/factoryModel';
 
-  import { getteampage,listUserByIds } from '@/api/workforceManagement/team';
+  import { getteampage, listUserByIds } from '@/api/workforceManagement/team';
 
   export default {
     components: {
@@ -448,7 +436,7 @@
           remark: '',
           taskIds: [],
           taskNames: [],
-          
+
           workstationSubstanceList: []
         };
       };
@@ -462,7 +450,7 @@
         areaTreeList: [],
 
         teamPagerList: [],
-        userList:[],
+        userList: [],
         // 表单验证规则
         rules: {
           code: [{ required: true, message: '请输入', trigger: 'blur' }],
@@ -562,6 +550,8 @@
         switch (this.type) {
           case 'add':
             return '新增工位';
+          case 'copy':
+            return '新增工位';
           case 'edit':
             return '编辑工位';
           default:
@@ -579,15 +569,15 @@
       chooseAsset() {
         this.$refs.productRefs.open(this.form.extInfo, '选择设备', '4');
       },
-      userListFn(e){
+      userListFn(e) {
         console.log(e);
         let that = this;
-        listUserByIds([e]).then(res => {
-          console.log(res,'5263',that.userList);
+        listUserByIds([e]).then((res) => {
+          console.log(res, '5263', that.userList);
           that.userList = res;
           // this.$set(this, 'userList', res);
         });
-// listUserByIds
+        // listUserByIds
         // userList
         // console.log(this.userList);
       },
@@ -601,14 +591,12 @@
         this.$refs.produceRef.open(param);
       },
       produceConfirm(data) {
-        console.log(data,'555555');
+        console.log(data, '555555');
 
         this.form.taskIds = [data.id];
         this.form.taskNames = [data.name];
 
         this.form.extInfo.workCenterId = data.workCenterId;
-    
-
       },
 
       determineChoose(title, row) {
@@ -632,7 +620,7 @@
       open(type, row) {
         this.type = type;
         this.visible = true;
-        if (type == 'edit') {
+        if (type == 'edit' || type == 'copy') {
           for (const key of Object.keys(this.form)) {
             if (key !== 'extInfo') {
               this.form[key] = row[key];
@@ -648,7 +636,7 @@
           if (this.form.extInfo.factoryId) {
             this.getlistCf();
           }
-          this.userList=[];
+          this.userList = [];
           if (this.form.extInfo.workshopPlanId) {
             this.getListWorkshopByParentId(true);
           }
@@ -659,6 +647,9 @@
             this.getUserPage();
           }
         }
+        if (this.type == 'copy') {
+            this.form.code = '';
+          }
         this.getListWorkCenter();
         this.getListProduce();
       },
@@ -706,7 +697,7 @@
           }
           this.loading = true;
 
-          if (this.type == 'add') {
+          if (this.type != 'edit') {
             delete this.form.id;
           }
           // this.form.workstationSubstanceList =
@@ -871,6 +862,9 @@
           if (res.taskList?.length) {
             this.form.taskNames = res.taskList.map((i) => i.name);
           }
+          if (this.type == 'copy') {
+            this.form.code = '';
+          }
         });
       }
     }

+ 9 - 0
src/views/factoryModel/station/index.vue

@@ -44,6 +44,15 @@
         </template>
         <!-- 操作列 -->
         <template v-slot:action="{ row }">
+          <el-link
+            type="primary"
+            :underline="false"
+            icon="el-icon-edit"
+            @click="openEdit('copy', row)"
+            v-if="$hasPermission('main:factoryworkstation:saveOrUpdate')"
+          >
+            复制
+          </el-link>
           <el-link
             type="primary"
             :underline="false"

+ 7 - 9
src/views/factoryModel/workshop/components/edit.vue

@@ -23,7 +23,6 @@
               v-model="form.code"
               placeholder="请输入车间编码"
               :disabled="type === 'edit'"
-
             />
           </el-form-item>
         </el-col>
@@ -258,10 +257,10 @@
         switch (this.type) {
           case 'add':
             return '新增车间';
-            break;
+          case 'copy':
+            return '新增车间';
           case 'edit':
             return '编辑车间';
-            break;
           default:
             break;
         }
@@ -271,7 +270,7 @@
       open(type, row) {
         this.type = type;
         this.visible = true;
-        if (type == 'edit') {
+        if (type == 'edit' || type == 'copy') {
           for (const key of Object.keys(this.form)) {
             if (key !== 'extInfo') {
               this.form[key] = row[key];
@@ -290,6 +289,9 @@
 
           this.getlistCf();
         }
+        if (type == 'copy') {
+          this.form.code = '';
+        }
       },
 
       async getFactoryList() {
@@ -302,15 +304,12 @@
       },
 
       change_factoryId(e) {
-
         this.form.workshopPlanId = '';
         this.workshopPlanList = [];
         this.form.parentId = '';
         this.getlistCf();
-
       },
 
-      
       getlistCf() {
         let par = {
           type: 2,
@@ -318,7 +317,6 @@
           size: 9999
         };
         getFactoryarea(par).then((res) => {
-          
           this.workshopPlanList = res.list;
         });
       },
@@ -347,7 +345,7 @@
           }
           this.loading = true;
 
-          if (this.type == 'add') {
+          if (this.type != 'edit') {
             delete this.form.id;
           }
 

+ 9 - 0
src/views/factoryModel/workshop/index.vue

@@ -34,6 +34,15 @@
 
         <!-- 操作列 -->
         <template v-slot:action="{ row }">
+          <el-link
+            type="primary"
+            :underline="false"
+            icon="el-icon-edit"
+            @click="openEdit('copy', row)"
+            v-if="$hasPermission('main:factoryarea:saveOrUpdate')"
+          >
+            复制
+          </el-link>
           <el-link
             type="primary"
             :underline="false"

+ 26 - 13
src/views/technology/work/components/user-edit.vue

@@ -15,11 +15,7 @@
       <el-row>
         <el-col :span="8">
           <el-form-item label="工作中心编码:" prop="code">
-            <el-input
-              clearable
-              v-model="form.code"
-              placeholder="请输入"
-            />
+            <el-input clearable v-model="form.code" placeholder="请输入" />
           </el-form-item>
         </el-col>
 
@@ -31,7 +27,11 @@
 
         <el-col :span="8">
           <el-form-item label="所属工厂:" prop="factoryId">
-            <el-select v-model="form.factoryId" filterable placeholder="所属工厂">
+            <el-select
+              v-model="form.factoryId"
+              filterable
+              placeholder="所属工厂"
+            >
               <el-option
                 v-for="item in flist"
                 :key="item.id"
@@ -44,7 +44,11 @@
         </el-col>
         <el-col :span="8">
           <el-form-item label="工作中心类别:" prop="categoryType">
-            <el-select v-model="form.categoryType" filterable placeholder="工作中心类别">
+            <el-select
+              v-model="form.categoryType"
+              filterable
+              placeholder="工作中心类别"
+            >
               <el-option
                 v-for="item in categoryTypes"
                 :key="item.code"
@@ -57,7 +61,11 @@
         </el-col>
         <el-col :span="8">
           <el-form-item label="负责人:" prop="leaderUserId">
-            <el-select v-model="form.leaderUserId" filterable placeholder="负责人">
+            <el-select
+              v-model="form.leaderUserId"
+              filterable
+              placeholder="负责人"
+            >
               <el-option
                 v-for="item in userList"
                 :key="item.id"
@@ -123,7 +131,9 @@
           name: [
             { required: true, message: '请输入工序名称', trigger: 'blur' }
           ],
-          code: [{ required: true, message: '工作中心编码', trigger: 'change' }],
+          code: [
+            { required: true, message: '工作中心编码', trigger: 'change' }
+          ],
           factoryId: [
             { required: true, message: '请选择所属工厂', trigger: 'blur' }
           ],
@@ -161,7 +171,7 @@
           let title = this.isUpdate ? '修改' : '保存';
           saveOrUpdate(this.form)
             .then((msg) => {
-              console.log(999,msg)
+              console.log(999, msg);
               this.form = {};
               this.loading = false;
               this.$message.success(title + msg);
@@ -184,12 +194,15 @@
       async visible(visible) {
         if (visible) {
           if (this.data) {
-          
-
             // const res = await work.getById(this.data.id);
 
             this.$util.assignObject(this.form, this.data);
-            this.isUpdate = true;
+            if (this.data.type == 'edit') {
+              this.isUpdate = true;
+            } else {
+              this.isUpdate = false;
+              this.form.code=''
+            }
           } else {
             this.isUpdate = false;
           }

+ 29 - 16
src/views/technology/work/index.vue

@@ -39,7 +39,7 @@
         <template v-slot:categoryType="{ row }">
           {{ checkcategoryType(row.categoryType) }}
         </template>
-<!--        <template v-slot:leaderUserId="{ row }">
+        <!--        <template v-slot:leaderUserId="{ row }">
           {{ checkleaderUserId(row.leaderUserId) }}
         </template> -->
         <!-- 状态列 -->
@@ -50,7 +50,16 @@
             type="primary"
             :underline="false"
             icon="el-icon-edit"
-            @click="openEdit(row)"
+            @click="openEdit(row,'copy')"
+            v-if="$hasPermission('main:workcenter:save')"
+          >
+            复制
+          </el-link>
+          <el-link
+            type="primary"
+            :underline="false"
+            icon="el-icon-edit"
+            @click="openEdit(row,'edit')"
             v-if="$hasPermission('main:workcenter:update')"
           >
             修改
@@ -94,12 +103,12 @@
 
   export default {
     name: 'technologyWork',
-    mixins:[tabMixins],
+    mixins: [tabMixins],
     components: {
       UserSearch,
       UserEdit
     },
-    data () {
+    data() {
       return {
         // 表格列配置
         columns: [
@@ -178,33 +187,33 @@
         cacheKeyUrl: '439a8ef9-technology-work'
       };
     },
-    created () {
+    created() {
       this.getfLise();
       this.getUserPage();
     },
     methods: {
       /*回显工厂 */
-      checkfactoryId (id) {
+      checkfactoryId(id) {
         let obj = this.fList.find((f) => f.id == id);
         return obj?.name;
       },
       /*回显类别 */
-      checkcategoryType (value) {
+      checkcategoryType(value) {
         return this.categoryTypes.find((f) => f.value == value).label;
       },
       /*回显负责人 */
-      checkleaderUserId (id) {
+      checkleaderUserId(id) {
         let obj = this.userList.find((f) => f.id == id);
         return obj?.name;
       },
       /*人员列表 */
-      async getUserPage () {
+      async getUserPage() {
         const res = await work.getUserPage();
         this.userList = res.list;
       },
       /*厂房列表 */
 
-      async getfLise () {
+      async getfLise() {
         const res = await route.Flist({
           pageNum: 1,
           size: -1,
@@ -213,7 +222,7 @@
         this.fList = res.list;
       },
       /* 表格数据源 */
-      async datasource ({ page, limit, where, order }) {
+      async datasource({ page, limit, where, order }) {
         const res = await work.list({
           ...where,
           ...order,
@@ -224,22 +233,26 @@
       },
 
       /* 刷新表格 */
-      reload (where) {
+      reload(where) {
         this.$refs.table.reload({ page: 1, where: where });
       },
       /* 打开编辑弹窗 */
-      openEdit (row) {
+      openEdit(row,type) {
         this.current = row;
+        if(this.current){
+          this.current.type=type
+        }
+       
         this.showEdit = true;
         this.$refs.userEdit.$refs.form &&
           this.$refs.userEdit.$refs.form.clearValidate();
       },
       /* 打开导入弹窗 */
-      openImport () {
+      openImport() {
         this.showImport = true;
       },
       /* 删除 */
-      remove (row) {
+      remove(row) {
         // const loading = this.$loading({ lock: true });
         this.loading = true;
 
@@ -257,7 +270,7 @@
           });
       },
       /* 批量删除 */
-      removeBatch () {
+      removeBatch() {
         if (!this.selection.length) {
           this.$message.error('请至少选择一条数据');
           return;

+ 19 - 19
src/views/workforceManagement/team/components/edit.vue

@@ -23,6 +23,7 @@
                 :maxlength="20"
                 v-model="form.code"
                 placeholder="请输入"
+                :disabled="type=='edit'"
               />
             </el-form-item>
           </el-col>
@@ -123,8 +124,6 @@
                   clearable
                   filterable
                   placeholder="请选择"
-        
-
                 >
                   <el-option
                     v-for="item in options.workCenterList"
@@ -177,7 +176,11 @@
         header="员工配置"
         body-style="padding: 22px 22px 0 22px;"
       >
-        <userTable ref="userTable" @deleteIds="deleteIds" :factoryId="form.factoryId"></userTable>
+        <userTable
+          ref="userTable"
+          @deleteIds="deleteIds"
+          :factoryId="form.factoryId"
+        ></userTable>
       </el-card>
     </el-form>
     <template v-slot:footer>
@@ -192,7 +195,6 @@
 <script>
   import {
     listWorkshopByParentId,
-    listFactoryLine,
     saveteam,
     updateteam,
     listFactoryLineByFactoryId
@@ -201,6 +203,7 @@
   import work from '@/api/technology/work';
   import userTable from './userTable.vue';
   import { getFactoryarea } from '@/api/factoryModel';
+  import { getCode } from '@/api/codeManagement/index.js';
   export default {
     components: {
       userTable
@@ -221,6 +224,7 @@
           // workshopId: [],
           factoryId: '',
           produceVersionId: '',
+          produceVersionName: '',
           status: 1
         };
       };
@@ -244,12 +248,7 @@
           factoryId: [
             { required: true, message: '请选择所属工厂', trigger: 'change' }
           ],
-          // workshopPlanId: [
-          //   { required: true, message: '请选择', trigger: 'change' }
-          // ],
-          // workshopId: [
-          //   { required: true, message: '请输入', trigger: 'change' }
-          // ],
+
           productionLineId: [
             { required: true, message: '请输入', trigger: 'change' }
           ],
@@ -294,18 +293,17 @@
         this.visible = true;
         this.deleteUserIds = [];
 
-        if (type == 'edit') {
+        if (type == 'edit' || type == 'copy') {
           for (const key of Object.keys(this.form)) {
             if (row[key]) {
               this.form[key] = row[key];
             }
 
-           this.form.workCenterId =this.form.workCenterIds[0];
+            this.form.workCenterId = this.form.workCenterIds[0];
           }
 
           // 人员反显
           this.$nextTick(() => {
-
             console.log('row', row);
             if (row.userVOList) {
               this.$refs.userTable.confirmStaffSelection(
@@ -322,6 +320,9 @@
           await this.getlistFactoryLineByParentId();
           await this.getlistByProductionLineId();
         }
+        if (type != 'edit') {
+          this.form.code = await getCode('main_team_code');
+        }
         this.getVersionList();
       },
       deleteIds(ids) {
@@ -347,12 +348,11 @@
           par.deleteUserIds = this.deleteUserIds;
           par.leaderUserId = this.$refs.userTable.getTwi();
           par.userNumber = par.userIds.length;
-          this.form.workCenterIds =  [ this.form.workCenterId ];
-          if (this.type == 'add') {
+          this.form.workCenterIds = [this.form.workCenterId];
+          if (this.type != 'edit') {
             delete par.id;
-         
           }
-          const saveOrUpdate = this.type == 'add' ? saveteam : updateteam;
+          const saveOrUpdate = this.type != 'edit'? saveteam : updateteam;
           saveOrUpdate(par)
             .then((msg) => {
               this.loading = false;
@@ -401,7 +401,7 @@
 
         // this.getlistCf();
         this.getlistFactoryLineByParentId();
-        this.form.workCenterId = null
+        this.form.workCenterId = null;
         this.form.workCenterIds = [];
         this.options.workCenterList = [];
 
@@ -441,7 +441,7 @@
       //     });
       //   });
       // },
-       // 获取产线
+      // 获取产线
       getlistFactoryLineByParentId() {
         return listFactoryLineByFactoryId([this.form.factoryId]).then((res) => {
           this.options.productionLineId = res.map((n) => {

+ 9 - 0
src/views/workforceManagement/team/index.vue

@@ -36,6 +36,15 @@
         </template>
         <!-- 操作列 -->
         <template v-slot:action="{ row }">
+          <el-link
+            type="primary"
+            :underline="false"
+            icon="el-icon-edit"
+            @click="openEdit('copy', row)"
+            v-if="$hasPermission('main:team:save')"
+          >
+            复制
+          </el-link>
           <el-link
             type="primary"
             :underline="false"