Răsfoiți Sursa

工艺管理提交

LAPTOP-16IUEB3P\Lenovo 2 ani în urmă
părinte
comite
9957260a49

+ 169 - 0
src/views/technology/production/components/WorkCenter.vue

@@ -0,0 +1,169 @@
+<template>
+  <el-dialog
+    title="选择工作中心"
+    :visible.sync="centerVisible"
+    :before-close="handleClose"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    width="60%"
+  >
+    <div>
+      <el-row>
+        <el-col :span="24" class="table_col">
+          <el-table
+            :data="tableData"
+            height="450"
+            highlight-current-row
+            @row-click="single"
+          >
+            <el-table-column label="工作中心编码" prop="code" width="200"></el-table-column>
+            <el-table-column label="工作中心名称" prop="name"></el-table-column>
+            <el-table-column label="工作中心类别" prop="categoryType">
+               <template slot-scope="scope">
+                 {{ checkcategoryType(scope.row.categoryType) }}
+               </template>
+            </el-table-column>
+            <el-table-column label="负责人" prop="leaderUserName">
+            </el-table-column>
+            <el-table-column label="选择" align="center">
+               <template slot-scope="scope">
+            	 <el-radio class="radio" v-model="radio" :label="scope.row.id"><i></i></el-radio>
+               </template>
+            </el-table-column>
+          </el-table>
+         <div class="pagination">
+            <el-pagination
+              background
+              layout="total, sizes, prev, pager, next, jumper"
+              :total="total"
+              :page-sizes="[10, 20, 50, 100]"
+              :page-size="pagination.size"
+              :current-page.sync="pagination.pageNum"
+              @current-change="handleCurrent"
+              @size-change="handleSize"
+            >
+            </el-pagination>
+          </div>
+        </el-col>
+      </el-row>
+    </div>
+    <div class="btns">
+      <el-button type="primary" size="small" @click="selected">选择</el-button>
+      <el-button size="small" @click="handleClose">关闭</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+ import work from '@/api/technology/work';
+export default {
+  data () {
+    return {
+      centerVisible: false,
+      tableData: [],
+      search:{},
+      pagination: {
+        pageNum: 1,
+        size: 10,
+      },
+      total: 0,
+      radio: '',
+      current:null,
+      categoryTypes: [
+        { label: '设备', value: 0 },
+        { label: '设备组', value: 1 },
+        { label: '人工', value: 2 },
+        { label: '人工组', value: 3 },
+        { label: '生产线', value: 4 },
+        { label: '委外生产', value: 5 }
+      ],
+    }
+  },
+
+  watch: {
+
+  },
+  methods: {
+    open(item){
+      if(item){
+        this.current = {
+          id:item.workCenterId,
+          name: item.workCenterName
+        }
+        this.radio = item.workCenterId
+      }
+      this.centerVisible = true
+      this.getList()
+    },
+
+    // 单击获取id
+    single (row) {
+        this.current = row
+        this.radio = row.id
+    },
+
+    handleClose () {
+      this.centerVisible = false
+      this.current = null
+      this.radio = ''
+    },
+    handleCurrent (page) {
+      this.pagination.pageNum = page
+      this.getList()
+    },
+    handleSize (size) {
+      this.pagination.pageNum = 1
+      this.pagination.size = size
+      this.getList()
+    },
+    getList(){
+      let params = {...this.pagination}
+      work.list(params).then(res=>{
+         this.tableData = res.list
+         this.total = res.count
+      })
+    },
+    selected(){
+       if(!this.current){
+         return this.$message.warning('请选择工作中心')
+       }
+       this.$emit('changeCenter',this.current)
+       this.handleClose()
+    },
+
+    /*回显类别 */
+    checkcategoryType (value) {
+      return this.categoryTypes.find((f) => f.value == value).label;
+    },
+
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.tree_col {
+  border: 1px solid #eee;
+  padding: 10px 0;
+  box-sizing: border-box;
+  height: 500px;
+  overflow: auto;
+}
+.table_col {
+  padding-left: 10px;
+  ::v-deep .el-table th.el-table__cell {
+    background: #f2f2f2;
+  }
+}
+.pagination {
+  text-align: right;
+  padding: 10px 0;
+}
+.btns {
+  text-align: center;
+  padding: 10px 0;
+}
+.topsearch{
+	margin-bottom:15px;
+}
+</style>

+ 32 - 10
src/views/technology/production/components/user-edit.vue

@@ -30,12 +30,20 @@
         </el-col>
         <el-col :span="8">
           <el-form-item label="控制码:" prop="controlId">
-            <el-input v-model="form.controlId" placeholder="请输入" />
+             <el-select v-model="form.controlId">
+               <el-option
+                 v-for="item in controlList"
+                 :key="item.id"
+                 :label="item.name"
+                 :value="item.id"
+               >
+               </el-option>
+             </el-select>
           </el-form-item>
         </el-col>
         <el-col :span="8">
-          <el-form-item label="工作中心:" prop="workCenterId">
-            <el-input placeholder="请输入" v-model="form.workCenterId" />
+          <el-form-item label="工作中心:" prop="workCenterName">
+            <el-input @click.native="chooseWorkCenter" v-model="form.workCenterName" readonly/>
           </el-form-item>
         </el-col>
         <el-col :span="8">
@@ -163,18 +171,22 @@
         保存
       </el-button>
     </template>
+
+    <!-- 工作中心弹窗 -->
+    <WorkCenter ref="centerRefs" @changeCenter='determineChoose'/>
   </ele-modal>
 </template>
 
 <script>
   import producetask from '@/api/technology/production';
-
+  import WorkCenter from './WorkCenter.vue';
   const defaultForm = {
     id: null,
     code: '',
     name: '',
     controlId: '',
     workCenterId: '',
+    workCenterName:'',
     timeUnit: '',
     intervalTime: {
       nextShortPreTime: '', // 时间单位转换后的下一个短周期的时间,格式为YYYY-MM-DDTHH'
@@ -195,11 +207,15 @@
     }
   };
   export default {
+    components:{
+       WorkCenter
+    },
     props: {
       // 弹窗是否打开
       visible: Boolean,
       // 修改回显的数据
-      data: Object
+      data: Object,
+      controlList:Array
     },
     data() {
       return {
@@ -224,8 +240,8 @@
           controlId: [
             { required: true, message: '请选择控制码', trigger: 'blur' }
           ],
-          workCenterId: [
-            { required: true, message: '请选择工作中心', trigger: 'blur' }
+          workCenterName: [
+            { required: true, message: '请选择工作中心', trigger: 'change' }
           ],
           timeUnit: [
             { required: true, message: '请选择时间单位', trigger: 'blur' }
@@ -234,7 +250,8 @@
         // 提交状态
         loading: false,
         // 是否是修改
-        isUpdate: false
+        isUpdate: false,
+        chooseItem:null,
       };
     },
     computed: {
@@ -253,6 +270,13 @@
       }
     },
     methods: {
+      chooseWorkCenter(){
+         this.$refs.centerRefs.open(this.form)
+      },
+      determineChoose(row){
+          this.$set(this.form,'workCenterName',row.name)
+          this.$set(this.form,'workCenterId',row.id)
+      },
       /* 保存编辑 */
       save() {
         this.$refs.form.validate((valid) => {
@@ -294,9 +318,7 @@
         if (visible) {
           if (this.data) {
             console.log(111111);
-
             const res = await producetask.getById(this.data.id);
-
             this.$util.assignObject(this.form, {
               ...res
             });

+ 15 - 4
src/views/technology/production/index.vue

@@ -83,6 +83,7 @@
     <user-edit
       :visible.sync="showEdit"
       :data="current"
+      :controlList="controlList"
       @done="reload"
       ref="userEdit"
     />
@@ -99,9 +100,8 @@
   import UserSearch from './components/user-search.vue';
   import UserEdit from './components/user-edit.vue';
   import UserSetting from './components/user-setting.vue';
-
   import producetask from '@/api/technology/production';
-
+  import control from '@/api/technology/control';
   export default {
     name: 'technologyProduction',
     components: {
@@ -169,7 +169,8 @@
         // 是否显示编辑弹窗
         showEdit: false,
         // 是否显示参数弹窗
-        showSetting: false
+        showSetting: false,
+        controlList:[]
       };
     },
     methods: {
@@ -195,10 +196,20 @@
       },
       /* 打开编辑弹窗 */
       openEdit(row) {
+        this.getControlList()
         this.current = row;
         this.showEdit = true;
         this.$refs.userEdit.$refs.form &&
-          this.$refs.userEdit.$refs.form.clearValidate();
+        this.$refs.userEdit.$refs.form.clearValidate();
+      },
+
+      getControlList(){
+         const params = {
+           pageNum: 1, size: -1
+         }
+         control.list().then(res=>{
+            this.controlList = res.list
+         })
       },
 
       /* 删除 */

+ 89 - 0
src/views/technology/version/components/user-search.vue

@@ -0,0 +1,89 @@
+<!-- 搜索表单 -->
+<template>
+  <el-form
+    label-width="80px"
+    class="ele-form-search"
+    @keyup.enter.native="search"
+    @submit.native.prevent
+  >
+    <el-row>
+      <el-col v-bind="styleResponsive ? { lg: 5, md: 12 } : { span: 4 }">
+        <el-form-item label="产品编码:">
+          <el-input clearable v-model="where.code" placeholder="请输入" />
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { lg: 5, md: 12 } : { span: 4 }">
+        <el-form-item label="产品名称:">
+          <el-input clearable v-model="where.name" placeholder="请输入" />
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { lg: 5, md: 12 } : { span: 4 }">
+        <el-form-item label="版本号:">
+          <el-input
+            clearable
+            v-model="where.version"
+            placeholder="请输入"
+          />
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { lg: 5, md: 12 } : { span: 4 }">
+        <el-form-item label="版本名称:">
+          <el-input
+            clearable
+            v-model="where.versionName"
+            placeholder="请输入"
+          />
+        </el-form-item>
+      </el-col>
+
+      <el-col v-bind="styleResponsive ? { lg: 4, md: 12 } : { span: 4 }">
+        <div class="ele-form-actions">
+          <el-button
+            type="primary"
+            icon="el-icon-search"
+            class="ele-btn-icon"
+            @click="search"
+          >
+            查询
+          </el-button>
+          <el-button @click="reset">重置</el-button>
+        </div>
+      </el-col>
+    </el-row>
+  </el-form>
+</template>
+
+<script>
+  export default {
+    data() {
+      // 默认表单数据
+      const defaultWhere = {
+        code: '',
+        name: '',
+        version: '',
+        versionName: ''
+      };
+      return {
+        // 表单数据
+        where: { ...defaultWhere },
+      };
+    },
+    computed: {
+      // 是否开启响应式布局
+      styleResponsive() {
+        return this.$store.state.theme.styleResponsive;
+      }
+    },
+    methods: {
+      /* 搜索 */
+      search() {
+        this.$emit('search', this.where);
+      },
+      /*  重置 */
+      reset() {
+        this.where = { ...this.defaultWhere };
+        this.search();
+      }
+    }
+  };
+</script>

+ 215 - 4
src/views/technology/version/index.vue

@@ -1,9 +1,220 @@
 <template>
-  <div>666</div>
+  <div class="ele-body">
+    <el-card shadow="never">
+      <!-- 搜索表单 -->
+      <user-search @search="reload" />
+      <!-- 数据表格 -->
+      <ele-pro-table
+        ref="table"
+        :columns="columns"
+        :datasource="datasource"
+        :selection.sync="selection"
+        row-key="code"
+      >
+        <!-- 表头工具栏 -->
+        <template v-slot:toolbar>
+          <el-button
+            size="small"
+            type="primary"
+            icon="el-icon-plus"
+            class="ele-btn-icon"
+            @click="openEdit()"
+          >
+            新建
+          </el-button>
+        </template>
+
+        <!-- 状态列 -->
+        <template v-slot:status="{ row }">
+          {{ checkStatus(row) }}
+        </template>
+
+        <!-- 操作列 -->
+        <template v-slot:action="{ row }">
+          <el-link
+            type="primary"
+            :underline="false"
+            icon="el-icon-edit"
+            @click="openEdit(row)"
+          >
+            修改
+          </el-link>
+          <el-popconfirm
+            class="ele-action"
+            title="确定要删除当前工序吗?"
+            @confirm="remove(row)"
+          >
+            <template v-slot:reference>
+              <el-link type="danger" :underline="false" icon="el-icon-delete">
+                删除
+              </el-link>
+            </template>
+          </el-popconfirm>
+        </template>
+      </ele-pro-table>
+    </el-card>
+
+  </div>
 </template>
 
 <script>
-  export default {};
-</script>
+  import UserSearch from './components/user-search.vue';
+  import route from '@/api/technology/route';
+  export default {
+    name: 'technologyVersion',
+    components: {
+      UserSearch,
+    },
+    data() {
+      return {
+        // 表格列配置
+        columns: [
+          {
+            columnKey: 'selection',
+            type: 'selection',
+            width: 45,
+            align: 'center',
+            fixed: 'left'
+          },
+
+          {
+            prop: 'code',
+            label: '产品编码',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 110
+          },
+          {
+            prop: 'name',
+            label: '产品名称',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 110
+          },
+          {
+            align: 'center',
+            prop: 'categoryCode',
+            label: '版本号',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'categoryName',
+            label: '版本名称',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'version',
+            label: '工艺路线编码',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'status',
+            label: '工艺版本号',
+            align: 'center',
+            slot: 'status',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
 
-<style></style>
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 220,
+            align: 'center',
+            resizable: false,
+            slot: 'action',
+            showOverflowTooltip: true
+          }
+        ],
+        // 表格选中数据
+        selection: [],
+        // 当前编辑数据
+        current: null,
+        // 是否显示编辑弹窗
+        showEdit: false,
+        // 是否显示导入弹窗
+        showImport: false,
+        statusList: [
+          { label: '草稿', value: -1 },
+          { label: '失效', value: 0 },
+          { label: '生效', value: 1 }
+        ]
+      };
+    },
+    methods: {
+      /* 表格数据源 */
+      async datasource({ page, limit, where, order }) {
+        const res = await route.list({
+          ...where,
+          ...order,
+          pageNum: page,
+          size: limit
+        });
+        return res;
+      },
+      checkStatus(row) {
+        let obj = this.statusList.find((it) => it.value == row.status);
+        return obj.label;
+      },
+
+      /* 刷新表格 */
+      reload(where) {
+        this.$refs.table.reload({ page: 1, where: where });
+      },
+      /* 打开编辑弹窗 */
+      openEdit(row) {
+        this.current = row;
+        this.showEdit = true;
+        this.$refs.userEdit.$refs.form &&
+          this.$refs.userEdit.$refs.form.clearValidate();
+      },
+
+      /* 删除 */
+      remove(row) {
+        const loading = this.$loading({ lock: true });
+
+        route
+          .delete(row.id)
+          .then((msg) => {
+            loading.close();
+            this.$message.success('删除' + msg);
+            this.reload();
+          })
+          .catch((e) => {
+            loading.close();
+            // this.$message.error(e.message);
+          });
+      },
+      /* 批量删除 */
+      removeBatch() {
+        if (!this.selection.length) {
+          this.$message.error('请至少选择一条数据');
+          return;
+        }
+        this.$confirm('确定要删除选中的工序吗?', '提示', {
+          type: 'warning'
+        })
+          .then(() => {
+            const loading = this.$loading({ lock: true });
+            producetask
+              .delete(this.selection.map((d) => d.id))
+              .then((msg) => {
+                loading.close();
+                this.$message.success('删除' + msg);
+                this.reload();
+              })
+              .catch((e) => {
+                loading.close();
+                // this.$message.error(e.message);
+              });
+          })
+          .catch(() => {});
+      }
+    }
+  };
+</script>

+ 20 - 19
src/views/technology/work/index.vue

@@ -35,9 +35,9 @@
         <template v-slot:categoryType="{ row }">
           {{ checkcategoryType(row.categoryType) }}
         </template>
-        <template v-slot:leaderUserId="{ row }">
+<!--        <template v-slot:leaderUserId="{ row }">
           {{ checkleaderUserId(row.leaderUserId) }}
-        </template>
+        </template> -->
         <!-- 状态列 -->
 
         <!-- 操作列 -->
@@ -91,7 +91,7 @@
       UserSearch,
       UserEdit
     },
-    data() {
+    data () {
       return {
         // 表格列配置
         columns: [
@@ -129,9 +129,9 @@
             align: 'center'
           },
           {
-            prop: 'leaderUserId',
+            prop: 'leaderUserName',
             label: '负责人',
-            slot: 'leaderUserId',
+            // slot: 'leaderUserId',
             showOverflowTooltip: true,
             align: 'center'
           },
@@ -169,32 +169,33 @@
         loading: false
       };
     },
-    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,
@@ -203,7 +204,7 @@
         this.fList = res.list;
       },
       /* 表格数据源 */
-      async datasource({ page, limit, where, order }) {
+      async datasource ({ page, limit, where, order }) {
         const res = await work.list({
           ...where,
           ...order,
@@ -214,22 +215,22 @@
       },
 
       /* 刷新表格 */
-      reload(where) {
+      reload (where) {
         this.$refs.table.reload({ page: 1, where: where });
       },
       /* 打开编辑弹窗 */
-      openEdit(row) {
+      openEdit (row) {
         this.current = row;
         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;
 
@@ -247,7 +248,7 @@
           });
       },
       /* 批量删除 */
-      removeBatch() {
+      removeBatch () {
         if (!this.selection.length) {
           this.$message.error('请至少选择一条数据');
           return;

+ 3 - 3
vue.config.js

@@ -33,11 +33,11 @@ module.exports = {
       '/api': {
         // target: 'http://192.168.3.51:18086', // 测试
         // target: 'http://192.168.3.35:8080', // kang杨威
-        target: 'http://192.168.3.25:8080', // 黄峥嵘
+        // target: 'http://192.168.3.25:8080', // 黄峥嵘
         // target: 'http://192.168.3.41:8080', // 何江鹏
-        // target: 'http://192.168.3.33:8080', // 谢一平
+        target: 'http://192.168.3.33:8080', // 谢一平
         // target: 'http://192.168.3.64:8080', // 粟勋
-        // target: 'http://192.168.3.34:8080', // 刘毅
+        // target: 'http://192.168.3.34:8080', // 刘毅
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域
         pathRewrite: {
           '^/api': ''