damon227 hace 1 mes
padre
commit
4a7af942f2

+ 161 - 120
src/views/modules/tech/draw-add-or-update.vue

@@ -1,13 +1,18 @@
 <template>
-    <div>
-      <!-- <el-dialog
+  <div>
+    <!-- <el-dialog
         :title="!id ? '新增': display ? '详情' : '修改'"
         width="70%"
         :close-on-click-modal="false"
         :visible.sync="visible"> -->
-        <div class="my-title">{{ !id ? '新增': display ? '详情' : '修改' }}</div>
-        <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
-          <el-form-item label="图纸编码" prop="drawingCode">
+    <div class="my-title">{{ !id ? "新增" : display ? "详情" : "修改" }}</div>
+    <el-form
+      :model="dataForm"
+      :rules="dataRule"
+      ref="dataForm"
+      label-width="auto"
+    >
+      <!-- <el-form-item label="图纸编码" prop="drawingCode">
             <el-input v-model="dataForm.drawingCode" :disabled="display || !id" placeholder="系统自动生成,无需填写"></el-input>
           </el-form-item>
           <el-form-item label="图纸名称" prop="drawingName">
@@ -18,137 +23,173 @@
           </el-form-item>
           <el-form-item label="版本" prop="version">
             <el-input v-model="dataForm.version" :disabled="display" placeholder="版本"></el-input>
-          </el-form-item>
-          <el-form-item label="图纸来源" prop="source">
-            <el-input v-model="dataForm.source" :disabled="display" placeholder="图纸来源"></el-input>
-          </el-form-item>
-          <el-form-item label="备注" prop="notes">
-            <el-input v-model="dataForm.notes" :disabled="display" placeholder="备注"></el-input>
-          </el-form-item>
-          <upload-component :display="display" :title="'图纸'" :accept="'image/*'" :file-obj-list="fileList" @uploadSuccess="uploadSuccess"/>
-        </el-form>
-        <span slot="footer" class="dialog-footer">
-          <el-button @click="onChose">取消</el-button>
-          <el-button v-if="!display" type="primary" @click="dataFormSubmit()" v-reClick>确定</el-button>
-        </span>
-      <!-- </el-dialog> -->
-    </div>
+          </el-form-item> -->
+      <el-form-item label="图纸来源" prop="source">
+        <el-input
+          v-model="dataForm.source"
+          :disabled="display"
+          placeholder="图纸来源"
+        ></el-input>
+      </el-form-item>
+      <el-form-item label="备注" prop="notes">
+        <el-input
+          v-model="dataForm.notes"
+          :disabled="display"
+          placeholder="备注"
+        ></el-input>
+      </el-form-item>
+      <upload-component
+        :display="display"
+        :title="'图纸'"
+        :accept="'image/*'"
+        :file-obj-list="fileList"
+        @uploadSuccess="uploadSuccess"
+      />
+      <div class="tip">
+        <span>命名要求:</span>
+        <span>图号(版本)图纸名称.xfdffg</span>
+      </div>
+    </el-form>
+    <span slot="footer" class="dialog-footer">
+      <el-button @click="onChose">取消</el-button>
+      <el-button
+        v-if="!display"
+        type="primary"
+        @click="dataFormSubmit()"
+        v-reClick
+        >确定</el-button
+      >
+    </span>
+    <!-- </el-dialog> -->
+  </div>
 </template>
 
 <script>
-  import { getDrawingDetail } from '@/api/product'
-  import UploadComponent from '../common/upload-component'
+import { getDrawingDetail } from '@/api/product'
+import UploadComponent from '../common/upload-component'
 
-  export default {
-    name: 'add-or-update',
-    components: {UploadComponent},
-    computed: {
-      orgId: {
-        get () { return this.$store.state.user.orgId }
+export default {
+  name: 'add-or-update',
+  components: { UploadComponent },
+  computed: {
+    orgId: {
+      get () {
+        return this.$store.state.user.orgId
+      }
+    }
+  },
+  // watch: {
+  //   'dataForm.isCompose' (value) {
+  //     this.dataForm.displayProductList = value === '1'
+  //   }
+  // },
+  data () {
+    return {
+      visible: false,
+      display: false,
+      fileList: [],
+      dataList: [],
+      id: 0,
+      dataForm: {},
+      optionsProducts: [],
+      dataRule: {
+        drawingName: [
+          { required: true, message: '图纸名称不能为空', trigger: 'blur' }
+        ],
+        source: [
+          { required: true, message: '图纸来源不能为空', trigger: 'blur' }
+        ]
       }
+    }
+  },
+  methods: {
+    onChose () {
+      this.$emit('onChose')
     },
-    // watch: {
-    //   'dataForm.isCompose' (value) {
-    //     this.dataForm.displayProductList = value === '1'
-    //   }
-    // },
-    data () {
-      return {
-        visible: false,
-        display: false,
-        fileList: [],
-        dataList: [],
-        id: 0,
-        dataForm: {},
-        optionsProducts: [],
-        dataRule: {
-          drawingName: [{ required: true, message: '图纸名称不能为空', trigger: 'blur' }],
-          source: [{ required: true, message: '图纸来源不能为空', trigger: 'blur' }]
+    async init (id, display) {
+      this.fileList = []
+      this.dataForm = {}
+      this.productDetails = []
+      this.materialList = []
+      this.optionsSource = []
+      this.optionsTech = []
+      this.optionsDraw = []
+      this.visible = true
+      this.id = id || 0
+      this.display = display
+      if (!id) return
+      await getDrawingDetail(this.id).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
+              })
+            })
+          }
         }
-      }
+      })
+    },
+    validateField (type) {
+      this.$refs.dataForm.validateField(type)
+    },
+    uploadSuccess (fileList) {
+      this.fileList = fileList
     },
-    methods: {
-      onChose () {
-        this.$emit('onChose')
-      },
-      async init (id, display) {
-        this.fileList = []
-        this.dataForm = {}
-        this.productDetails = []
-        this.materialList = []
-        this.optionsSource = []
-        this.optionsTech = []
-        this.optionsDraw = []
-        this.visible = true
-        this.id = id || 0
-        this.display = display
-        if (!id) return
-        await getDrawingDetail(this.id).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
-                })
+    // 表单提交
+    dataFormSubmit () {
+      this.$refs['dataForm'].validate((valid) => {
+        if (valid) {
+          // 添加附件
+          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
           }
-        })
-      },
-      validateField (type) {
-        this.$refs.dataForm.validateField(type)
-      },
-      uploadSuccess (fileList) {
-        this.fileList = fileList
-      },
-      // 表单提交
-      dataFormSubmit () {
-        this.$refs['dataForm'].validate((valid) => {
-          if (valid) {
-            // 添加附件
-            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
-                })
-              }
+          this.$http({
+            url: !this.id
+              ? this.$http.adornUrl(`/biz-service/drawing/save`)
+              : this.$http.adornUrl(`/biz-service/drawing/update`),
+            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('请上传文件')
-              return
+              this.$message.error(data.msg)
             }
-            this.$http({
-              url: !this.id ? this.$http.adornUrl(`/biz-service/drawing/save`) : this.$http.adornUrl(`/biz-service/drawing/update`),
-              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)
-              }
-            })
-          }
-        })
-      }
+          })
+        }
+      })
     }
   }
+}
 </script>
 
 <style scoped>
-
+.tip {
+  color: gray;
+  padding-top: 20px;
+  display: inline-block;
+}
 </style>

+ 7 - 8
src/views/modules/tech/draw-management.vue

@@ -35,14 +35,14 @@
           width="50"
           align="center">
         </el-table-column>
-        <el-table-column
+        <!-- <el-table-column
           prop="drawingCode"
           header-align="center"
           align="center"
           min-width="100"
           :show-tooltip-when-overflow="true"
           label="图纸编码">
-        </el-table-column>
+        </el-table-column> -->
         <el-table-column
           prop="drawingName"
           header-align="center"
@@ -67,7 +67,7 @@
           :show-tooltip-when-overflow="true"
           label="版本">
         </el-table-column>
-        <el-table-column
+        <!-- <el-table-column
           prop="productName"
           header-align="center"
           align="center"
@@ -82,20 +82,20 @@
           min-width="200"
           :show-overflow-tooltip="true"
           label="来源">
-        </el-table-column>
+        </el-table-column> -->
         <el-table-column
           prop="createTime"
           header-align="center"
           align="center"
           min-width="160"
-          label="创建时间">
+          label="上传时间">
         </el-table-column>
         <el-table-column
           prop="creatorName"
           header-align="center"
           align="center"
           min-width="100"
-          label="上传">
+          label="上传">
         </el-table-column>
         <el-table-column
           prop="notes"
@@ -112,8 +112,7 @@
           width="150"
           label="操作">
           <template slot-scope="scope">
-            <el-button v-if="isAuth('pro:drawing:info')" type="text" size="small" @click="detailHandle(scope.row.drawingId)">查看</el-button>
-            <el-button v-if="isAuth('pro:drawing:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.drawingId, false)">编辑</el-button>
+            <el-button type="text" size="small" @click="detailHandle(scope.row.drawingId)">删除</el-button>
           </template>
         </el-table-column>
       </el-table>

+ 2 - 2
src/views/modules/tech/file-manage.vue

@@ -98,8 +98,8 @@
           width="150"
           label="操作">
           <template slot-scope="scope">
-            <el-button v-if="isAuth('pro:worktype:info')" type="text" size="small" @click="detailHandle(scope.row)">查看</el-button>
-            <el-button v-if="isAuth('pro:worktype:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row, false)">编辑</el-button>
+            <el-button type="text" size="small" @click="detailHandle(scope.row)">查看</el-button>
+            <el-button type="text" size="small" @click="addOrUpdateHandle(scope.row, false)">编辑</el-button>
           </template>
         </el-table-column>
       </el-table>