liqianyi 3 年 前
コミット
e8df346211

+ 130 - 0
src/views/modules/tech/product-change.vue

@@ -0,0 +1,130 @@
+<template>
+    <div>
+        <div class="my-title">产品变更</div>
+        <!-- 表单 -->
+      <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
+        <el-row class="my-row">
+          <el-form-item label="更改内容描述" prop="description">
+            <el-input type="textarea" v-model="dataForm.description" placeholder="请输入更改内容描述"></el-input>
+          </el-form-item>
+        </el-row>
+        <el-row class="my-row">
+          <upload-component :title="'产品变更通知单'" :accept="'*'" :file-obj-list="fileList" @uploadSuccess="uploadSuccess"/>
+        </el-row>
+      </el-form>
+        <span slot="footer" class="dialog-footer">
+          <el-button @click="onChose">取消</el-button>
+          <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
+        </span>
+    </div>
+</template>
+
+<script>
+  import UserComponents from '../common/user-components'
+  import UploadComponent from '../common/upload-component'
+  import { getProductDetail } from '@/api/product'
+
+export default {
+    name: 'product-add-or-update',
+    components: {
+      UploadComponent,
+      UserComponents
+    },
+    computed: {
+      orgId: {
+        get () { return this.$store.state.user.orgId }
+      }
+    },
+    data () {
+      return {
+        visible: false,
+        dataForm: {
+          description: ''
+        },
+        id: 0,
+        fileList: [],
+        dataRule: {
+          description: [{ required: true, message: '更改内容简述不能为空', trigger: 'blur' }]
+        }
+      }
+    },
+    methods: {
+      onChose () {
+        this.$emit('onChose')
+      },
+      async init (id) {
+        this.fileList = []
+        this.visible = true
+        this.id = id || 0
+        if (!id) return
+        this.dataForm.bizId = id
+        await getProductDetail(id).then(({data}) => {
+          if (data && data.code === '200' && data.data) {
+            this.dataForm = data.data.noticeChangeRecord
+            if (data.data.noticeChangeRecord && data.data.noticeChangeRecord.attachList) {
+              data.data.noticeChangeRecord.attachList.forEach((item) => {
+                this.fileList.push({
+                  name: item.fileName,
+                  url: item.url,
+                  id: item.url
+                })
+              })
+            }
+          } else {
+            this.$message.error(data.msg)
+          }
+        })
+      },
+      validateField (type) {
+        this.$refs.dataForm.validateField(type)
+      },
+      // 表单提交
+      dataFormSubmit () {
+        // 产品技术文件
+        let fList = this.fileList
+        if (fList.length > 0) {
+          this.dataForm.attachList = []
+          for (let i = 0; i < fList.length; i++) {
+            this.dataForm.attachList.push({
+              fileName: fList[i].name,
+              url: fList[i].url
+            })
+          }
+        } else {
+          this.$message.error('请上传文件')
+          return
+        }
+        this.$refs['dataForm'].validate((valid) => {
+          if (valid) {
+            this.$http({
+              url: this.$http.adornUrl(`/biz-service/product/change`),
+              method: 'post',
+              data: this.$http.adornData({...this.dataForm, orgId: this.orgId})
+            }).then(({data}) => {
+              if (data && data.code === '200') {
+                this.$message({
+                  message: '操作成功',
+                  type: 'success',
+                  duration: 1500,
+                  onClose: () => {
+                    this.onChose()
+                    this.$emit('refreshDataList')
+                  }
+                })
+              } else {
+                this.$message.error(data.msg)
+              }
+            })
+          }
+        })
+      },
+      uploadSuccess (fileList) {
+        this.fileList = fileList
+      }
+    }
+  }
+</script>
+
+<style scoped>
+
+</style>

+ 8 - 0
src/views/modules/tech/product-detail.vue

@@ -34,6 +34,14 @@
         <e-desc-item label="产品类别">{{dataForm.productTypeValue}}</e-desc-item>
 
         <e-desc-item label="产品来源">{{dataForm.sourceName}}</e-desc-item>
+        <e-desc-item v-if="dataForm.noticeChangeRecord" label="产品变更描述">{{dataForm.noticeChangeRecord?dataForm.noticeChangeRecord.description:''}}</e-desc-item>
+
+        <e-desc-item v-if="dataForm.noticeChangeRecord && dataForm.noticeChangeRecord.attachList" label="变更通知单" span="3">
+          <div v-for="(item, index) in dataForm.noticeChangeRecord.attachList" style="display: inline">
+            <span v-if="index > 0">,</span>
+            <a :key="item.fileName + index" type="primary" href="#" @click="previewFile(item.fileName, item.url)">{{ item.fileName }}</a>
+          </div>
+        </e-desc-item>
 
         <e-desc-item v-if="fileList" label="产品图纸" span="3">
           <div v-for="(item, index) in fileList" style="display: inline">

+ 24 - 3
src/views/modules/tech/product-management.vue

@@ -1,7 +1,7 @@
 <!-- 产品管理 -->
 <template>
   <div class="product-management">
-    <template v-if="!addOrUpdateVisible && !attachVisible && !detailVisible && !craftsVisible && !drawVisible && !changeVisible">
+    <template v-if="!addOrUpdateVisible && !changeFormVisible && !attachVisible && !detailVisible && !craftsVisible && !drawVisible && !changeVisible && !noticeChangeVisible">
       <el-form :inline="true" :model="dataForm" @keyup.enter.native="search()">
         <el-form-item label="名称">
           <el-input v-model="dataForm.productName" placeholder="产品名称" clearable/>
@@ -149,6 +149,7 @@
           <template slot-scope="scope">
             <el-button v-if="isAuth('pro:product:info')" type="text" size="small" @click="detailHandle(scope.row.productId)">查看</el-button>
             <el-button v-if="isAuth('pro:product:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.productId, false)">编辑</el-button>
+            <el-button v-if="isAuth('pro:product:change')" type="text" size="small" @click="changeHandle(scope.row.productId)">变更</el-button>
           </template>
         </el-table-column>
       </el-table>
@@ -169,6 +170,8 @@
     <product-draw-detail v-if="drawVisible" ref="drawDetail" @onChose="onChose"/>
     <attach-detail v-if="changeVisible" ref="changeDetail" @onChose="onChose"/>
     <attach-detail v-if="attachVisible" ref="attachDetail" @onChose="onChose"/>
+    <notice-change-setting v-if="noticeChangeVisible" ref="noticeChangeSetting" @onChose="onChose"/>
+    <change-form v-if="changeFormVisible" ref="changeForm" @refreshDataList="getDataList" @onChose="onChose"/>
   </div>
 </template>
 
@@ -180,6 +183,8 @@
   import CraftsDetail from './crafts-detail'
   import ProductDrawDetail from './product-draw-detail'
   import AttachDetail from '../common/attach-detail'
+  import NoticeChangeSetting from './product-notice-change-setting'
+  import ChangeForm from './product-change'
 export default {
     name: 'product-management',
     components: {
@@ -187,7 +192,9 @@ export default {
       ProductDrawDetail,
       CraftsDetail,
       AddOrUpdate,
-      Detail
+      Detail,
+      NoticeChangeSetting,
+      ChangeForm
     },
     data () {
       return {
@@ -197,6 +204,8 @@ export default {
         craftsVisible: false,
         drawVisible: false,
         changeVisible: false,
+        noticeChangeVisible: false,
+        changeFormVisible: false,
         dataForm: {},
         dataList: [],
         pageIndex: 1,
@@ -220,6 +229,8 @@ export default {
         this.craftsVisible = false
         this.drawVisible = false
         this.changeVisible = false
+        this.noticeChangeVisible = false
+        this.changeFormVisible = false
       },
       // 获取产品类别字典
       getTypeList () {
@@ -306,6 +317,13 @@ export default {
           this.$refs.addOrUpdate.init(id, disable)
         })
       },
+      // 变更
+      changeHandle (id) {
+        this.changeFormVisible = true
+        this.$nextTick(() => {
+          this.$refs.changeForm.init(id)
+        })
+      },
       // 转换属性“产品类别”
       typeFormat (row) {
         if (this.optionsType) {
@@ -332,7 +350,10 @@ export default {
       },
       // 变更通知人设置
       setNoticeChangeHandel () {
-        // todo
+        this.noticeChangeVisible = true
+        this.$nextTick(() => {
+          this.$refs.noticeChangeSetting.init()
+        })
       },
       // 对应图纸
       drawDetails (row) {

+ 20 - 388
src/views/modules/tech/product-notice-change-setting.vue

@@ -1,187 +1,13 @@
 <template>
     <div>
-        <div class="my-title">{{ !id ? '新增': display ? '详情' : '修改' }}</div>
-        <!-- 工作流 -->
-        <div v-show="display && dataForm.workFlowBusinessExt">
-          <el-steps :active="dataForm.workFlowBusinessExt&&dataForm.workFlowBusinessExt.workFlowProcessStepList?dataForm.workFlowBusinessExt.workFlowProcessStepList.length + 2:0" align-center style="margin-bottom: 20px">
-            <template v-for="(item, i) in stepList">
-              <el-step :icon="item.icon" :title="item.title" :description="item.description"></el-step>
-            </template>
-          </el-steps>
-          <el-collapse style="margin-bottom: 20px">
-            <el-collapse-item>
-              <template slot="title">
-                <span style="color: red">审批日志(展开查看更多):</span>
-              </template>
-              <template v-for="(item, i) in logList">
-                <div>{{++i}}:{{item.approverName}}  {{item.createTime}}  {{item.approvalValue}}</div>
-              </template>
-            </el-collapse-item>
-          </el-collapse>
-        </div>
+        <div class="my-title">变更通知人设置</div>
         <!-- 表单 -->
         <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
           <el-row class="my-row">
-            <el-col :span="8">
-              <el-form-item label="产品名称" prop="productName">
-                <el-input v-model="dataForm.productName" :disabled="display" placeholder="产品名称"></el-input>
-              </el-form-item>
-            </el-col>
-            <el-col :span="8">
-              <el-form-item label="产品规格" prop="productSpec">
-                <el-input v-model="dataForm.productSpec" :disabled="display" placeholder="产品规格"></el-input>
-              </el-form-item>
-            </el-col>
-            <el-col :span="8">
-              <el-form-item label="产品类别" prop="productType">
-                <el-select
-                  v-model="dataForm.productType"
-                  :disabled="display"
-                  remote
-                  placeholder="请选择">
-                  <el-option
-                    v-for="item in optionsType"
-                    :key="item.code"
-                    :label="item.value"
-                    :value="item.code">
-                  </el-option>
-                </el-select>
-              </el-form-item>
-            </el-col>
-          </el-row>
-          <el-row class="my-row">
-            <el-col :span="8">
-              <el-form-item label="产品来源" prop="source">
-                <cus-component v-model="dataForm.source" :cus-id.sync="dataForm.source"></cus-component>
-              </el-form-item>
-            </el-col>
-            <el-col :span="8">
-              <el-form-item label="产品图纸" prop="drawingIdList">
-                <draw-components v-model="dataForm.drawingIdList" :draw-ids="dataForm.drawingIdList" @change='receiverChange'></draw-components>
-              </el-form-item>
-            </el-col>
-            <el-col :span="8">
-              <el-form-item label="所需文件资料" prop="docIdList">
-                <doc-components v-model="dataForm.docIdList" :doc-ids="dataForm.docIdList" @change='docSelectChange'/>
-              </el-form-item>
-            </el-col>
-          </el-row>
-          <el-row class="my-row">
-            <upload-component :title="'产品技术文件(多选)'" :accept="'*'" :file-obj-list="fileList" @uploadSuccess="uploadSuccess"/>
-          </el-row>
-          <el-row class="my-row" style="margin-top: 20px">
-            <el-form-item label="备注" prop="notes">
-              <el-input type="textarea" v-model="dataForm.notes" :disabled="display"></el-input>
+            <el-form-item label="通知接收人" prop="userIds">
+              <user-components v-model="dataForm.userIds" :userIds="dataForm.userIds" @change="userSelectedChanged"/>
             </el-form-item>
           </el-row>
-          <el-row class="my-row">
-            <el-form-item label="是否组合产品" prop="displayProductList">
-              <el-switch
-                v-model="dataForm.displayProductList"
-                :disabled="display"
-                active-color="#13ce66"
-                inactive-color="#ff4949"
-                active-text="是"
-                inactive-text="否">
-              </el-switch>
-            </el-form-item>
-          </el-row>
-          <el-row v-if="dataForm.displayProductList">
-            <div class="title"><span style="color: red">*</span> 组合小产品</div>
-            <el-table
-              :data="productDetails"
-              border
-              style="width: 100%;">
-              <el-table-column
-                label="序号"
-                type="index"
-                width="50"
-                align="center">
-              </el-table-column>
-              <el-table-column
-                prop="productName"
-                header-align="center"
-                align="center"
-                label="产品名称">
-              </el-table-column>
-              <el-table-column
-                prop="productSpec"
-                header-align="center"
-                align="center"
-                label="规格">
-              </el-table-column>
-              <el-table-column
-                prop="cnt"
-                header-align="center"
-                align="center"
-                label="数量"
-                width="170">
-                <template slot-scope="scope">
-                  <el-input-number v-model="scope.row.cnt" :disabled="display" :min="1" style="width: 140px;"/>
-                </template>
-              </el-table-column>
-              <el-table-column
-                prop="notes"
-                header-align="center"
-                align="center"
-                label="备注">
-              </el-table-column>
-            </el-table>
-            <el-row style="text-align: center; margin-top: 10px;">
-              <el-button v-show="!display" type="primary" icon="el-icon-plus" @click="addProduct"></el-button>
-            </el-row>
-          </el-row>
-          <el-row>
-            <div class="title"><span style="color: red">*</span> 产品配料清单</div>
-            <el-table
-              :data="materialList"
-              border
-              style="width: 100%;">
-              <el-table-column
-                label="序号"
-                type="index"
-                width="50"
-                align="center">
-              </el-table-column>
-              <el-table-column
-                prop="materialName"
-                header-align="center"
-                align="center"
-                label="物品名称">
-              </el-table-column>
-              <el-table-column
-                prop="specifications"
-                header-align="center"
-                align="center"
-                label="规格">
-              </el-table-column>
-              <el-table-column
-                prop="cnt"
-                header-align="center"
-                align="center"
-                label="数量"
-                width="170">
-                <template slot-scope="scope">
-                  <el-input-number v-model="scope.row.cnt" :disabled="display" :min="0" style="width: 140px;"/>
-                </template>
-              </el-table-column>
-              <el-table-column
-                prop="unitName"
-                header-align="center"
-                align="center"
-                label="单位">
-              </el-table-column>
-              <el-table-column
-                prop="notes"
-                header-align="center"
-                align="center"
-                label="备注">
-              </el-table-column>
-            </el-table>
-            <el-row style="text-align: center; margin-top: 10px;">
-              <el-button v-show="!display" type="primary" icon="el-icon-plus" @click="addMaterial"></el-button>
-            </el-row>
-          </el-row>
         </el-form>
         <span slot="footer" class="dialog-footer">
           <el-button @click="onChose">取消</el-button>
@@ -191,190 +17,39 @@
 </template>
 
 <script>
-  import templateChose from '../product/template-chose'
-  import templateChoseMaterial from '../product/template-chose-material'
-  import { getDictList } from '@/api/dict'
-  import { getProductDetail } from '@/api/product'
-  import UploadComponent from '../common/upload-component'
-  import { dealStepData, dealStepLogs } from '@/api/util'
-  import CusComponent from '../common/cus-component'
-  import DrawComponents from '../common/draw-components'
-  import DocComponents from '../common/doc-components'
+  import UserComponents from '../common/user-components'
 
 export default {
     name: 'product-add-or-update',
-    components: {DocComponents, DrawComponents, CusComponent, UploadComponent, templateChose, templateChoseMaterial},
-    computed: {
-      orgId: {
-        get () { return this.$store.state.user.orgId }
-      }
-    },
-    watch: {
-      'dataForm.isCompose' (value) {
-        this.dataForm.displayProductList = value === '1'
-      }
+    components: {
+      UserComponents
     },
     data () {
       return {
-        productListVisible: false,
-        materialListVisible: false,
         visible: false,
-        display: false,
-        optionsType: [],
-        // optionsTech: [],
-        fileList: [],
-        dataList: [],
-        id: 0,
-        productDetails: [],
-        materialList: [],
         dataForm: {
-          displayProductList: false
+          userIds: []
         },
         dataRule: {
-          productName: [{ required: true, message: '产品名称不能为空', trigger: 'blur' }],
-          productSpec: [{ required: true, message: '产品规格不能为空', trigger: 'blur' }],
-          productType: [{ required: true, message: '产品类别不能为空', trigger: 'change' }],
-          docIdList: [{ required: true, message: '所需文件资料不能为空', trigger: 'change' }],
-          source: [{ required: true, message: '产品来源不能为空', trigger: 'change' }],
-          drawingIdList: [{ required: true, message: '产品图纸不能为空', trigger: 'blur' }]
-        },
-        stepList: [],
-        logList: []
+          userIds: [{ required: true, message: '请选择通知接收人', trigger: 'change' }]
+        }
       }
     },
     methods: {
       onChose () {
         this.$emit('onChose')
       },
-      async init (id, display) {
-        this.fileList = []
-        this.stepList = []
-        this.logList = []
+      async init () {
         this.dataForm = {}
-        this.productDetails = []
-        this.materialList = []
-        // this.optionsTech = []
-        // this.optionsDraw = []
-        this.visible = true
-        this.id = id || 0
-        this.display = display
-        // 获取产品类别
-        await getDictList({type: 'product_type'}).then(({data}) => {
-          if (data) {
-            this.optionsType = data
-          }
-        })
-        // 产品工艺
-        if (!id) return
-        await getProductDetail(this.id).then(({data}) => {
+        this.$http({
+          url: this.$http.adornUrl(`/biz-service/product/noteChangeConfig`),
+          method: 'get'
+        }).then(({data}) => {
           if (data && data.code === '200') {
-            this.dataForm = data.data
-            // 附件
-            if (data.data.attachList) {
-              data.data.attachList.forEach((item) => {
-                this.fileList.push({
-                  name: item.fileName,
-                  url: item.url,
-                  id: item.url
-                })
-              })
-            }
-            // 流程图展示
-            if (data.data.workFlowBusinessExt) {
-              dealStepData(data.data.workFlowBusinessExt.workFlowProcessStepList, this.stepList)
-              dealStepLogs(data.data.workFlowBusinessExt.processLogList, this.logList)
-            }
-            // 组合小产品
-            data.data.composeProductMaterialList.forEach((item) => {
-              this.productDetails.push(item)
-            })
-            // 产品配料清单
-            data.data.productMaterialList.forEach((item) => {
-              this.materialList.push(item)
-            })
-            // 产品来源
-            if (data.data.source) {
-              this.optionsSource = [{
-                code: data.data.source,
-                value: data.data.sourceName
-              }]
-            }
-            // 产品工艺
-            if (data.data.techId) {
-              this.optionsTech = [{
-                code: data.data.techId,
-                value: data.data.techName
-              }]
-            }
-            // 产品图纸
-            if (data.data.proDrawings) {
-              this.dataForm.drawingIdList = []
-              data.data.proDrawings.forEach((item) => {
-                if (item.attachList) {
-                  item.attachList.forEach((item1) => {
-                    this.fileList.push({
-                      name: item1.fileName,
-                      url: item1.url,
-                      id: item1.url
-                    })
-                  })
-                }
-                // this.optionsDraw.push({
-                //   code: item.drawingId,
-                //   value: item.drawingName
-                // })
-                this.dataForm.drawingIdList.push(item.drawingId)
-              })
-            }
+            this.dataForm.userIds = data.data
           }
         })
-      },
-      uploadSuccess (fileList) {
-        this.fileList = fileList
-      },
-      // 添加组合产品
-      addProduct () {
-        this.productListVisible = true
-        this.$nextTick(() => {
-          this.$refs.productList.init()
-        })
-      },
-      addProductItems (items) {
-        this.productDetails = []
-        items.forEach((item) => {
-          this.addProductItem(item)
-        })
-      },
-      addProductItem (item) {
-        this.productDetails.push({
-          productId: item.productId,
-          productName: item.productName,
-          productSpec: item.productSpec,
-          cnt: 1,
-          notes: item.notes
-        })
-      },
-      addMaterial () {
-        this.materialListVisible = true
-        this.$nextTick(() => {
-          this.$refs.materialList.init()
-        })
-      },
-      addMaterialItems (items) {
-        this.materialList = []
-        items.forEach((item) => {
-          this.addMaterialItem(item)
-        })
-      },
-      addMaterialItem (item) {
-        this.materialList.push({
-          materialId: item.materialId,
-          materialName: item.materialName,
-          specifications: item.specifications,
-          cnt: 0,
-          unitName: item.unitName,
-          notes: item.notes
-        })
+        this.visible = true
       },
       validateField (type) {
         this.$refs.dataForm.validateField(type)
@@ -383,48 +58,10 @@ export default {
       dataFormSubmit () {
         this.$refs['dataForm'].validate((valid) => {
           if (valid) {
-            // 组合小产品
-            this.dataForm.composeProductMaterialList = []
-            const b1 = this.dataForm.displayProductList
-            this.dataForm.isCompose = b1 === true ? '1' : '0'
-            if (this.dataForm.isCompose === '1' && this.productDetails.length > 0) {
-              this.productDetails.forEach((item) => {
-                this.dataForm.composeProductMaterialList.push({
-                  cnt: item.cnt,
-                  materialId: item.productId,
-                  notes: item.notes
-                })
-              })
-            }
-            // 产品配料清单
-            this.dataForm.productMaterialList = []
-            if (this.materialList.length > 0) {
-              this.materialList.forEach((item) => {
-                this.dataForm.productMaterialList.push({
-                  cnt: item.cnt,
-                  materialId: item.materialId,
-                  notes: item.notes
-                })
-              })
-            }
-            // 产品技术文件
-            let fList = this.fileList
-            if (fList.length > 0) {
-              this.dataForm.attachList = []
-              for (let i = 0; i < fList.length; i++) {
-                this.dataForm.attachList.push({
-                  fileName: fList[i].name,
-                  url: fList[i].url
-                })
-              }
-            } else {
-              this.$message.error('请上传文件')
-              return
-            }
             this.$http({
-              url: this.$http.adornUrl(`/biz-service/product/save`),
+              url: this.$http.adornUrl(`/biz-service/product/noteChangeConfig`),
               method: 'post',
-              data: this.$http.adornData({...this.dataForm, orgId: this.orgId})
+              data: this.dataForm.userIds
             }).then(({data}) => {
               if (data && data.code === '200') {
                 this.$message({
@@ -433,7 +70,6 @@ export default {
                   duration: 1500,
                   onClose: () => {
                     this.onChose()
-                    this.$emit('refreshDataList')
                   }
                 })
               } else {
@@ -443,12 +79,8 @@ export default {
           }
         })
       },
-      receiverChange (val) {
-        this.dataForm.drawingIdList = val
-      },
-      docSelectChange (val) {
-        console.log(val)
-        this.dataForm.docIdList = val
+      userSelectedChanged (val) {
+        this.dataForm.userIds = val
       }
     }
   }