qymljy 3 miesięcy temu
rodzic
commit
3aaa614b1c

+ 188 - 0
src/HDrpManagement/serveWorkBill/components/checkInfo.vue

@@ -0,0 +1,188 @@
+<template>
+  <div>
+    <el-button size="mini" type="primary" @click="checkBtn">{{
+        $t("确认信息")
+      }}</el-button>
+    <el-drawer
+        :title="$t(`确认工单信息`)"
+        append-to-body
+        :show-close="false"
+        :visible.sync="drawShow"
+        size="800px"
+    >
+      <div class="drawer__panel">
+        <el-row :gutter="20">
+          <el-form
+              :model="form"
+              :rules="rules"
+              ref="form"
+              :label-width="tool.onlyZh('140px')"
+              label-position="top"
+              size="mini"
+          >
+            <el-col :span="24">
+              <el-form-item :label="$t(`是否为我司出货产品:`)" prop="isouritem">
+                <el-radio-group v-model="form.isouritem">
+                  <el-radio :label="1">{{ $t("是") }}</el-radio>
+                  <el-radio :label="0">{{ $t("否") }}</el-radio>
+                </el-radio-group>
+              </el-form-item>
+            </el-col>
+            <el-col :span="24">
+              <el-form-item :label="$t(`是否在保质期内:`)" prop="inqualityguaranteeperiod">
+                <el-radio-group v-model="form.inqualityguaranteeperiod">
+                  <el-radio :label="1">{{ $t("是") }}</el-radio>
+                  <el-radio :label="0">{{ $t("否") }}</el-radio>
+                </el-radio-group>
+              </el-form-item>
+            </el-col>
+            <el-col :span="24">
+              <el-form-item :label="$t(`确认客诉异常描述是否属实:`)" prop="isfact">
+                <el-radio-group v-model="form.isfact">
+                  <el-radio :label="1">{{ $t("是") }}</el-radio>
+                  <el-radio :label="0">{{ $t("否") }}</el-radio>
+                </el-radio-group>
+              </el-form-item>
+            </el-col>
+            <el-col :span="24">
+              <el-form-item :label="$t('备注')" prop="remarks">
+                <el-input
+                    type="textarea"
+                    v-model="form.remarks"
+                    :placeholder="$t(`请输入备注`)"
+                ></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="24">
+              <el-form-item  :label="$t(`上传附件`)+':'">
+                <uploadFile
+                    @uploadGet="loading = true"
+                    ref="uploadRef"
+                    class="inline-16"
+                    :folderid="folderid"
+                    :bindData="{
+                    ownertable: 'sa_workorder',
+                    ownerid: $route.query.id,
+                    usetype: 'default',
+                  }"
+                    :ownerid="$route.query.id"
+                    @onSuccess="uploadSuccess"
+                ></uploadFile>
+              </el-form-item>
+            </el-col>
+          </el-form>
+        </el-row>
+      </div>
+      <div class="fixed__btn__panel">
+        <el-button
+            size="small"
+            @click="drawShow = false"
+            class="normal-btn-width"
+        >{{ $t("取 消") }}</el-button
+        >
+        <el-button
+            size="small"
+            type="warning"
+            @click="onSubmit"
+            class="normal-btn-width btn-warning"
+        >{{ $t("确 定") }}</el-button
+        >
+      </div>
+    </el-drawer>
+  </div>
+</template>
+
+<script>
+import uploadFile from "./upload";
+export default {
+  name: "checkInfo",
+  props:['data'],
+  components:{uploadFile},
+  data(){
+    return {
+      drawShow:false,
+      loading:false,
+      form:{
+        "sa_workorderid": "",
+        "isouritem": 1, //是否为我司产品
+        "inqualityguaranteeperiod": 1, //是否在保
+        "isfact": 0, //异常属实
+        "remarks": ""
+      },
+      rules:{
+        isouritem: [
+          {
+            required: true,
+            message: this.$t("请选择是否为我司出货产品"),
+            trigger: "change",
+          },
+        ],
+        inqualityguaranteeperiod: [
+          {
+            required: true,
+            message: this.$t("请选择是否在保质期内"),
+            trigger: "change",
+          },
+        ],
+        isfact: [
+          {
+            required: true,
+            message: this.$t("请确认客诉异常描述是否属实"),
+            trigger: "change",
+          },
+        ],
+      },
+      folderid:JSON.parse(sessionStorage.getItem('folderid')).appfolderid,
+    }
+  },
+  methods:{
+    checkBtn(){
+      this.drawShow = true
+      this.uploadSuccess()
+      this.form = {
+        "sa_workorderid": this.data.sa_workorderid,
+        "isouritem": this.data.isouritem, //是否为我司产品
+        "inqualityguaranteeperiod": this.data.inqualityguaranteeperiod, //是否在保
+        "isfact": this.data.isfact, //异常属实
+        "remarks": this.data.remarks
+      }
+    },
+    onSubmit(){
+      this.$refs.form.validate(async (valid) => {
+        if (!valid) return false
+        const res = await this.$api.requested({
+          id:'2026012714172302',
+          content:this.form
+        })
+      })
+    },
+    async uploadSuccess(res1){
+      this.listFile = []
+      this.attachmentids = res1?res1.data.attachmentids:[]
+      const res = await this.$api.requested({
+        classname: "system.attachment.Attachment",
+        method: "queryFileLink",
+        content: {
+          ownertable: "sa_workorder",
+          ownerid: this.$route.query.id,
+          usetype: "",
+        },
+      });
+      this.$refs.uploadRef.listFile = res.data.map((item) => {
+        return {
+          name: item.document,
+          url: item.url,
+          linksid: item.linksid,
+          attachmentid:item.attachmentid
+        };
+      });
+      this.listFile = this.$refs.uploadRef.listFile
+      this.loading = false;
+    },
+  }
+}
+</script>
+
+<style scoped>
+
+</style>

+ 157 - 0
src/HDrpManagement/serveWorkBill/components/upload.vue

@@ -0,0 +1,157 @@
+<template>
+  <el-upload
+      ref="uploadMy"
+      class="upload-demo"
+      action="#"
+      :accept='accept'
+      :on-preview="handlePreview"
+      :on-progress="handleProgress"
+      :on-remove="handleRemove"
+      :before-remove="beforeRemove"
+      :on-change="handleChange"
+      multiple
+      :auto-upload="false"
+      :file-list="listFile">
+    <el-button icon="el-icon-upload2" type="primary" size="mini" >上传文件</el-button>
+  </el-upload>
+</template>
+
+<script>
+export default {
+  name: "index",
+  props:["bindData","folderid",'title','accept'],
+  data() {
+    return {
+      listFile: [],
+      params: {
+        "classname": "system.attachment.huawei.OBS",
+        "method": "getFileName",
+        "content": {
+          "filename": '',
+          "filetype": '',
+          "parentid": ""//归属文件夹ID
+        }
+      },
+      count:0,
+      file: {},
+      filelist: [],
+      oldCount:0
+    };
+  },
+  mounted() {
+  },
+  methods: {
+    async handleRemove(file, fileList) {
+      this.$emit('uploadGet')
+      const res = await this.$api.requested({
+        "classname": "system.attachment.Attachment",
+        "method": "deleteFileLink",
+        "content": {
+          "linksids":[file.linksid]
+        }
+      })
+      this.oldCount = this.oldCount - 1
+      this.$emit('onSuccess',res)
+    },
+    handleProgress(file,fileList){
+
+    },
+    handlePreview(file) {
+      /*this.fileList = fileList*/
+    },
+    beforeRemove(file, fileList) {
+      return this.$confirm(`确定移除 ${ file.name }?`);
+    },
+    handleChange (file, filelist) {
+      this.$emit('uploadGet')
+      this.filelist = []
+      this.filelist = filelist
+      var index = file.raw.name.lastIndexOf(".");
+      var ext = file.name.substr(index + 1);
+      this.params.content.filename = file.raw.name
+      this.params.content.filetype = ext
+      this.getUploadUrl(file, ext)
+    },
+
+    // 获取华为云上传地址
+    async getUploadUrl (file, ext) {
+      this.params.content.parentid = this.folderid
+      const res = await this.$api.requested(this.params)
+      let url = res.data.uploadurl
+      let obsfilename = res.data.serialfilename
+
+      this.upoladFileToServer(url, file, ext, obsfilename)
+    },
+
+    // 上传到华为云
+    async upoladFileToServer (url, file, ext, obsfilename) {
+      console.log(file)
+      let THIS = this
+      let config = {
+        headers: ext === 'pdf' ? { 'Content-Type': 'application/pdf' } : ext === 'svg'?{ 'Content-Type': 'image/svg+xml' } : { 'Content-Type': 'application/octet-stream' },
+        onUploadProgress: function (progressEvent) {
+          let percent = progressEvent.loaded / progressEvent.total * 100
+          THIS.filelist.forEach(e => {
+            if (e.uid === file.uid) {
+              THIS.$set(e, 'type', ext.toUpperCase());
+              THIS.$set(e, 'progress', percent);
+            }
+          })
+        },
+      }
+      const res = await this.$upload.hw_upload(url, file.raw, config)
+      this.createFileRecord(obsfilename)
+    },
+
+    // 上传成功以后生成附件记录
+    async createFileRecord (obsfilename,attinfos) {
+      let obj = {
+        "serialfilename": obsfilename
+      }
+      obj = Object.assign({},obj,this.bindData)
+      let param = {
+        "classname": "system.attachment.huawei.OBS",
+        "method": "uploadSuccess",
+        "content":obj
+      }
+      const res = await this.$api.requested(param)
+      console.log("上传文件",res)
+      this.count++
+      console.log(this.count,'count')
+      console.log(this.filelist.length,'length')
+      if (this.count == this.filelist.length - this.oldCount) {
+        this.oldCount = this.oldCount +  this.count
+        this.count = 0
+        console.log(this.count,'count')
+        console.log('触发');
+        this.$refs.uploadMy.clearFiles()
+        this.filelist = []
+        this.$emit('onSuccess',res)
+      }
+      // if (res.code ===  1) {
+      //   this.$emit('onSuccess',res)
+      // }
+    },
+    async uploadSuccess(){
+      const res = await this.$api.requested({
+        "classname": "system.attachment.Attachment",
+        "method": "queryFileLink",
+        "content": {
+          "ownertable": 'sa_quotedprice',
+          "ownerid": this.ownerid,
+          "usetype":""
+        }
+      })
+    }
+  }
+}
+</script>
+
+<style scoped>
+/deep/ .el-upload {
+  display: inline-block;
+   text-align: left;
+  cursor: pointer;
+  outline: 0;
+}
+</style>

+ 59 - 2
src/HDrpManagement/serveWorkBill/modules/detail.vue

@@ -17,6 +17,25 @@
     >
       <div slot="tags"></div>
       <div slot="customOperation">
+        <checkInfo :data="mainData" class="inline-16"></checkInfo>
+        <transferWorkOrder btnType="primary" btnTitle="转工单" class="inline-16" @dialogShow="queryPerson" :disabledSubmit="personName == ''"
+        @onSubmit="transferWorkSubmit" ref="transferWorkRef">
+          <template slot="formRule">
+            <div>
+              <span style="color: red">*</span>{{$t(`请选择工单负责人`)}}
+            </div>
+            <div style="margin-top: 10px;width: 100%">
+              <el-select v-model="personName" placeholder="请选择" style="width: 100%" size="small">
+                <el-option
+                    v-for="item in optionNames"
+                    :key="item.index"
+                    :label="item.username"
+                    :value="item.userid">
+                </el-option>
+              </el-select>
+            </div>
+          </template>
+        </transferWorkOrder>
          <customBtn
           btnName="接单"
           message="确认接单当前服务工单吗?"
@@ -106,6 +125,8 @@ import teamList from "./teamList/index";
 import Items from "./items/index";
 import selectTeam from "../components/teamSelect";
 import serviceWorkOrder from '../modules/serviceWorkOrder/index'
+import checkInfo from '../components/checkInfo'
+import transferWorkOrder from '@/components/dialogTemplate/index2'
 import { log } from "@antv/g2plot/lib/utils";
 export default {
   name: "detail",
@@ -118,7 +139,9 @@ export default {
       active_accoun:JSON.parse(sessionStorage.getItem('active_account')),
       folderid:JSON.parse(sessionStorage.getItem('folderid')),
       team_name:'',
-      team_phone_number:''
+      team_phone_number:'',
+      personName:'',
+      optionNames:[]
     };
   },
   components: {
@@ -130,7 +153,9 @@ export default {
     teamList,
     Items,
     selectTeam,
-    serviceWorkOrder
+    serviceWorkOrder,
+    checkInfo,
+    transferWorkOrder
   },
   methods: {
     async queryMainData(id) {
@@ -297,6 +322,7 @@ export default {
           label: "操作类型",
           value: this.mainData.actiontype,
         },
+        { label:'备注',  value: this.mainData.remarks}
       ];
       this.detailInfo = [
         {
@@ -434,6 +460,37 @@ export default {
       this.queryMainData(this.$route.query.id);
       this.$emit("onSuccess");
     },
+    async queryPerson(){
+      const res = await this.$api.requested({
+        id:20230213143003,
+        content:{
+          pageNumber:1,
+          pageSize:999,
+        }
+      })
+      console.log(res.data,'333')
+      this.optionNames = res.data.map(item => {
+        return {
+          "username":item.username,
+          "userid":item.userid
+        }
+      })
+
+    },
+    async transferWorkSubmit(){
+      const res = await this.$api.requested({
+        "content": {
+          "sa_workorderid": this.$route.query.id,
+          "userid": this.personName //1566
+        },
+        "id": 2026012714183302,
+      })
+      this.tool.showMessage(res,()=>{
+        this.$refs.transferWorkRef.dialogTableVisible = false
+        this.personName = ''
+        this.queryMainData()
+      })
+    }
   },
   mounted() {
     this.queryMainData(this.$route.query.id);

+ 2 - 2
src/components/dialogTemplate/index2.vue

@@ -5,7 +5,7 @@
       <slot name="formRule"></slot>
       <div slot="footer" class="dialog-footer">
         <el-button @click="onCancel" size="small">{{$t(`取 消`)}}</el-button>
-        <el-button type="primary" @click="onSubmit" size="small">{{$t(`确 定`)}}</el-button>
+        <el-button :type="disabled?'':'primary'" @click="onSubmit" size="small" :disabled="disabledSubmit">{{$t(`确 定`)}}</el-button>
       </div>
     </el-dialog>
   </div>
@@ -14,7 +14,7 @@
 <script>
 export default {
   name: "index2",
-  props:["btnTitle","disabled","btnType","content",'dialogTitle'],
+  props:["btnTitle","disabled","btnType","content",'dialogTitle','disabledSubmit'],
   data(){
     return {
       dialogTableVisible:false,