瀏覽代碼

编程(调整)

chrislee 2 周之前
父節點
當前提交
00af8c0817

+ 21 - 45
src/views/modules/common/upload-component.vue

@@ -4,26 +4,11 @@
       <div v-show="displayTitle" class="title">
         <span v-show="displayStar" style="color: red">*</span> {{ title }}
       </div>
-      <el-upload
-        :disabled="display"
-        class="upload-demo"
-        ref="upload"
-        :multiple="multiple"
-        action="#"
-        :accept="accept"
-        :on-preview="handlePreview"
-        :on-remove="handleRemove"
-        :on-change="handleChange"
-        :file-list="fileList"
-        :limit="limit"
-        :on-exceed="handleExceed"
-        :http-request="handleUpload"
-        :auto-upload="true"
-        style="margin-top: 10px; margin-left: 10px"
-      >
-        <el-button v-show="!display" slot="trigger" size="small" type="primary"
-          >点击上传</el-button
-        >
+      <el-upload :disabled="display" class="upload-demo" ref="upload" :multiple="multiple" action="#" :accept="accept"
+        :on-preview="handlePreview" :on-remove="handleRemove" :on-change="handleChange" :file-list="fileList"
+        :limit="limit" :on-exceed="handleExceed" :http-request="handleUpload" :auto-upload="true"
+        style="margin-top: 10px; margin-left: 10px">
+        <el-button v-show="!display" slot="trigger" size="small" type="primary">点击上传</el-button>
         <!-- <el-button
           v-show="!display"
           style="margin-left: 10px"
@@ -32,21 +17,12 @@
           @click="submitUpload"
           >开始上传</el-button
         > -->
-         <el-button v-if="templateCode !== ''" size="small" @click="downloadTemplate">下载模板</el-button>
+        <el-button v-if="templateCode !== ''" size="small" @click="downloadTemplate">下载模板</el-button>
       </el-upload>
     </el-col>
     <!-- 图片预览 -->
-    <el-dialog
-      title="图片预览"
-      :append-to-body="true"
-      :visible.sync="previewVisible"
-      width="50%"
-    >
-      <img
-        :src="previewPath"
-        :alt="previewName"
-        style="width: 100%; height: 100%"
-      />
+    <el-dialog title="图片预览" :append-to-body="true" :visible.sync="previewVisible" width="50%">
+      <img :src="previewPath" :alt="previewName" style="width: 100%; height: 100%" />
     </el-dialog>
   </section>
 </template>
@@ -95,14 +71,15 @@ export default {
     }
   },
   watch: {
-    fileList (newVal) {
+    fileList(newVal) {
       this.$emit('uploadSuccess', newVal)
     },
-    fileObjList (newVal) {
+    fileObjList(newVal) {
+      console.log(newVal)
       this.fileList = newVal
     }
   },
-  data () {
+  data() {
     return {
       fileList: [],
       uploadUrl: uploadUrl,
@@ -112,8 +89,8 @@ export default {
     }
   },
   methods: {
-    handleUpload (file) {
-      function getBase64 (file) {
+    handleUpload(file) {
+      function getBase64(file) {
         return new Promise((resolve, reject) => {
           const reader = new FileReader()
           reader.readAsDataURL(file)
@@ -143,7 +120,7 @@ export default {
       })
     },
     // 上传
-    submitUpload () {
+    submitUpload() {
       this.$refs.upload.submit()
       // // 判断是否有文件
       // if (this.fileList.length === 0) {
@@ -175,11 +152,11 @@ export default {
       // });
     },
     // 移除
-    handleRemove (file, fileList) {
+    handleRemove(file, fileList) {
       this.fileList = fileList
     },
     // 预览
-    handlePreview (file) {
+    handlePreview(file) {
       if (!file || !file.name || !file.url) {
         this.$message.error('没有可预览的文件!')
         return
@@ -195,20 +172,19 @@ export default {
       }
     },
     // 改变上传内容
-    handleChange (file, fileList) {
+    handleChange(file, fileList) {
       console.log('fileList:', fileList)
       this.fileList = fileList
     },
     // 超限
-    handleExceed (files, fileList) {
+    handleExceed(files, fileList) {
       this.$message.warning(
-        `当前限制选择 ${this.limit} 个文件,本次选择了 ${
-          files.length
+        `当前限制选择 ${this.limit} 个文件,本次选择了 ${files.length
         } 个文件,共选择了 ${files.length + fileList.length} 个文件`
       )
     },
     // 下载模板
-    downloadTemplate () {
+    downloadTemplate() {
       if (this.templateCode !== '') {
         location.href = this.$http.adornUrl(`/file-service/minio-file/systemTable/download/${this.templateCode}`)
       }

+ 14 - 7
src/views/modules/tech/program-add-or-update.vue

@@ -96,7 +96,7 @@
             </el-form-item>
             <el-form-item label="程序文件">
               <upload-component :display-title="false" :displayStar="false" :accept="'*'"
-                :file-obj-list="rowForm.attachList || []" @uploadSuccess="handleUploadSuccess" />
+                :file-obj-list="rowForm.attachList" @uploadSuccess="handleUploadSuccess" />
             </el-form-item>
           </el-form>
           <span slot="footer">
@@ -197,19 +197,25 @@ export default {
             return;
           }
           // proProgramDetailsList 中附件字段name转为fileName
-          this.dataForm.proProgramDetailsList.forEach((item) => {
-            item.attachList.forEach((attach) => {
+          if (this.type === 1 && this.dataForm.proProgramDetailsList) {
+            this.dataForm.proProgramDetailsList.forEach((item) => {
+              item.attachList.forEach((attach) => {
+                attach.fileName = attach.name;
+              });
+            });
+          } else if (this.rowForm.attachList) {
+            this.rowForm.attachList.forEach((attach) => {
               attach.fileName = attach.name;
             });
-          });
-          // console.log(this.dataForm)
+          }
+          // console.log(this.rowForm)
           // return
           this.$http({
             url: this.type === 1
               ? this.$http.adornUrl(`/biz-service/proProgram/updateProcessing`)
               : this.$http.adornUrl(`/biz-service/proProgram/update`),
             method: "post",
-            data: this.$http.adornData({ ...this.dataForm, orgId: this.orgId }),
+            data: this.type === 1 ? this.$http.adornData({ ...this.dataForm, orgId: this.orgId }) : this.$http.adornData(this.rowForm),
           }).then(({ data }) => {
             if (data && data.code === "200") {
               this.$message({
@@ -237,6 +243,7 @@ export default {
         nodeName: "",
         require: "",
         num: 1,
+        preTaskTime: 1,
         attachList: [],
       });
     },
@@ -257,7 +264,7 @@ export default {
       this.rowForm = {
         nodeName: '',
         require: '',
-        preTaskTime: 0,
+        preTaskTime: 1,
         num: 1,
         attachList: []
       }

+ 4 - 4
src/views/modules/tech/program.vue

@@ -68,12 +68,12 @@
         <el-table-column prop="responsibilityPerson" header-align="center" align="center" min-width="100"
           :show-tooltip-when-overflow="true" label="责任人">
         </el-table-column>
-        <el-table-column fixed="right" header-align="center" align="center" width="130" label="操作">
+        <el-table-column fixed="right" header-align="center" align="center" width="90" label="操作">
           <template slot-scope="scope">
             <el-button type="text" size="small" @click="showDetail(scope.row.programId)">查看</el-button>
-            <el-button v-if="isAuth('pro:program:updateProcessing')" type="text" size="small"
-              @click="addOrUpdateHandle(scope.row.programId, 1)">处理</el-button>
-            <el-button v-if="isAuth('pro:program:update')" type="text" size="small"
+            <el-button v-if="isAuth('pro:program:updateProcessing') && Number(scope.row.state) === 1" type="text"
+              size="small" @click="addOrUpdateHandle(scope.row.programId, 1)">处理</el-button>
+            <el-button v-if="isAuth('pro:program:update') && Number(scope.row.state) === 2" type="text" size="small"
               @click="addOrUpdateHandle(scope.row.programId, 2)">编辑</el-button>
           </template>
         </el-table-column>