|
|
@@ -4,19 +4,43 @@
|
|
|
<el-row :gutter="20">
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="任务标题" prop="progressTitle">
|
|
|
- <el-input v-model="form.progressTitle" placeholder="请输入任务标题" />
|
|
|
+ <el-input v-model="form.progressTitle" :disabled="!editable" placeholder="请输入任务标题" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="12">
|
|
|
+ <!-- <el-col :span="12">
|
|
|
<el-form-item label="任务内容" prop="progressContext">
|
|
|
<el-input v-model="form.progressContext" placeholder="请输入任务内容" />
|
|
|
</el-form-item>
|
|
|
+ </el-col> -->
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="任务类型" prop="progressType">
|
|
|
+ <el-select v-model="form.progressType" disabled placeholder="请选择任务类型" style="width: 100%">
|
|
|
+ <el-option label="发货任务单" value="10" />
|
|
|
+ <el-option label="组装任务单" value="20" />
|
|
|
+ <el-option label="部署安装单" value="30" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="负责人" prop="principalPerson">
|
|
|
+ <el-input
|
|
|
+ ref="principalPerson"
|
|
|
+ v-model="form.principalPerson"
|
|
|
+ :disabled="!editable"
|
|
|
+ placeholder="请选择负责人"
|
|
|
+ readonly
|
|
|
+ suffix-icon="el-icon-search"
|
|
|
+ @focus="openUser(false, 'principalPersonId', 'principalPerson')" />
|
|
|
+ </el-form-item>
|
|
|
</el-col>
|
|
|
- </el-row>
|
|
|
- <el-row :gutter="20">
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="优先级" prop="progressLevel">
|
|
|
- <el-select v-model="form.progressLevel" clearable placeholder="优先级" style="width: 100%">
|
|
|
+ <el-select
|
|
|
+ v-model="form.progressLevel"
|
|
|
+ clearable
|
|
|
+ :disabled="!editable"
|
|
|
+ placeholder="优先级"
|
|
|
+ style="width: 100%">
|
|
|
<el-option label="最高" value="10" />
|
|
|
<el-option label="普通" value="20" />
|
|
|
<el-option label="较低" value="30" />
|
|
|
@@ -24,78 +48,184 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="12">
|
|
|
- <el-form-item label="时间范围" prop="date">
|
|
|
+ <el-form-item label="开始/截止时间" prop="date">
|
|
|
<el-date-picker
|
|
|
v-model="form.date"
|
|
|
- end-placeholder="结束日期"
|
|
|
+ :disabled="!editable"
|
|
|
+ end-placeholder="结束时间"
|
|
|
range-separator="至"
|
|
|
- start-placeholder="开始日期"
|
|
|
+ start-placeholder="开始时间"
|
|
|
style="width: 100%"
|
|
|
type="datetimerange"
|
|
|
value-format="yyyy-MM-dd HH:mm:ss" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- </el-row>
|
|
|
- <el-row :gutter="20">
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-table ref="productTable" :data="products" style="width: 100%">
|
|
|
+ <el-table-column type="selection" width="55" />
|
|
|
+ <el-table-column label="产品名称" prop="productName" />
|
|
|
+ <el-table-column label="产品编号" prop="productCode" />
|
|
|
+ <el-table-column label="数量" prop="productNum" />
|
|
|
+ <el-table-column v-if="form.progressType == '10'" label="获取方式">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-select
|
|
|
+ v-model="scope.row.operateType"
|
|
|
+ :disabled="!productEditable"
|
|
|
+ placeholder="方式"
|
|
|
+ style="width: 100%">
|
|
|
+ <el-option label="组装" value="组装" />
|
|
|
+ <el-option label="外购" value="外购" />
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-col>
|
|
|
+ <el-col v-if="theProgress && theProgress.deliverStatus >= 30" :span="12">
|
|
|
+ <el-form-item label="快递名称">
|
|
|
+ <el-input v-model="theProgress.expressName" disabled />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col v-if="theProgress && theProgress.deliverStatus >= 30" :span="12">
|
|
|
+ <el-form-item label="快递单号">
|
|
|
+ <el-input v-model="theProgress.expressCode" disabled />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col v-if="theProgress && theProgress.deliverStatus >= 30" :span="12">
|
|
|
+ <el-form-item label="预计到货时间">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="theProgress.estimatedArrivalTime"
|
|
|
+ disabled
|
|
|
+ style="width: 100%"
|
|
|
+ type="date"
|
|
|
+ value-format="yyyy-MM-dd" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col v-if="theProgress && theProgress.deliverStatus >= 40" :span="12">
|
|
|
+ <el-form-item label="到货时间">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="theProgress.arrivalTime"
|
|
|
+ disabled
|
|
|
+ style="width: 100%"
|
|
|
+ type="date"
|
|
|
+ value-format="yyyy-MM-dd" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24" style="margin-top: 10px; margin-bottom: 10px">
|
|
|
+ <el-button
|
|
|
+ v-if="theProgress && theProgress.assembleFileName != ''"
|
|
|
+ size="mini"
|
|
|
+ type="primary"
|
|
|
+ @click="showFile(theProgress.assembleFileUrl, theProgress.assembleFileName)">
|
|
|
+ 组装报告:{{ theProgress.assembleFileName }}
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ v-if="theProgress && theProgress.checkFileName != ''"
|
|
|
+ size="mini"
|
|
|
+ type="primary"
|
|
|
+ @click="showFile(theProgress.checkFileUrl, theProgress.checkFileName)">
|
|
|
+ 验收单:{{ theProgress.checkFileName }}
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ v-if="theProgress && theProgress.installCheckFileName != ''"
|
|
|
+ size="mini"
|
|
|
+ type="primary"
|
|
|
+ @click="showFile(theProgress.installCheckFileUrl, theProgress.installCheckFileName)">
|
|
|
+ 安装验收单:{{ theProgress.installCheckFileName }}
|
|
|
+ </el-button>
|
|
|
+ </el-col>
|
|
|
<el-col :span="24">
|
|
|
<el-form-item label="备注" prop="remark">
|
|
|
- <el-input v-model="form.remark" placeholder="请输入备注信息" :rows="5" show-word-limit type="textarea" />
|
|
|
+ <el-input
|
|
|
+ v-model="form.remark"
|
|
|
+ :disabled="!editable"
|
|
|
+ placeholder="请输入备注信息"
|
|
|
+ :rows="5"
|
|
|
+ show-word-limit
|
|
|
+ type="textarea" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</el-form>
|
|
|
<template #footer>
|
|
|
<el-button @click="close">取 消</el-button>
|
|
|
- <el-button type="primary" @click="save">确 定</el-button>
|
|
|
+ <el-button v-if="editable" type="primary" @click="save">确 定</el-button>
|
|
|
</template>
|
|
|
-
|
|
|
- <!-- 选择支持人员弹窗 -->
|
|
|
+ <!-- 选择用户 -->
|
|
|
+ <select-user ref="user" :label="label" :multiple="multiple" :property="property" @save="getUser" />
|
|
|
</el-dialog>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+ import SelectUser from '@/components/select/SelectUser'
|
|
|
import deliverWorkApi from '@/api/work/deliverWork'
|
|
|
+ import orderWorkApi from '@/api/work/deliver'
|
|
|
+ import to from 'await-to-js'
|
|
|
+
|
|
|
export default {
|
|
|
name: 'WorkOrderFeedback',
|
|
|
- components: {},
|
|
|
+ components: { SelectUser },
|
|
|
data() {
|
|
|
return {
|
|
|
+ theProgress: {},
|
|
|
form: {
|
|
|
progressTitle: undefined,
|
|
|
+ progressType: '',
|
|
|
progressContext: '',
|
|
|
date: [],
|
|
|
progressLevel: '10',
|
|
|
+ principalPersonId: '',
|
|
|
+ principalPerson: '',
|
|
|
remark: undefined,
|
|
|
},
|
|
|
rules: {
|
|
|
progressTitle: [{ required: true, message: '不能为空', trigger: ['blur', 'change'] }],
|
|
|
progressContext: [{ required: true, message: '不能为空', trigger: ['blur', 'change'] }],
|
|
|
+ principalPerson: [{ required: true, trigger: 'change', message: '请选择负责人' }],
|
|
|
date: [{ required: true, message: '不能为空', trigger: ['blur', 'change'] }],
|
|
|
},
|
|
|
dialogFormVisible: false,
|
|
|
planId: 0,
|
|
|
workId: 0,
|
|
|
title: '',
|
|
|
+ orderId: '',
|
|
|
+ multiple: '',
|
|
|
+ property: '',
|
|
|
+ label: '',
|
|
|
+ products: [],
|
|
|
+ allProducts: [],
|
|
|
+ deliverProducts: [],
|
|
|
+ installProducts: [],
|
|
|
+ selfProducts: [],
|
|
|
+ productEditable: false,
|
|
|
+ editable: false,
|
|
|
}
|
|
|
},
|
|
|
mounted() {},
|
|
|
methods: {
|
|
|
- open(planId, row) {
|
|
|
+ open(planId, orderId, type, editable, row) {
|
|
|
+ this.theProgress = row
|
|
|
this.planId = planId
|
|
|
+ this.editable = editable
|
|
|
+ this.orderId = orderId
|
|
|
if (row) {
|
|
|
this.workId = row.id
|
|
|
this.title = '编辑'
|
|
|
this.form = {
|
|
|
progressTitle: row.progressTitle,
|
|
|
+ progressType: row.progressType,
|
|
|
progressContext: row.progressContext,
|
|
|
date: [row.startDate, row.endDate],
|
|
|
progressLevel: row.progressLevel,
|
|
|
+ principalPersonId: row.principalPersonId,
|
|
|
+ principalPerson: row.principalPerson,
|
|
|
remark: row.remark,
|
|
|
}
|
|
|
} else {
|
|
|
this.title = '新建工作项'
|
|
|
+ this.form.progressType = type
|
|
|
this.workId = 0
|
|
|
}
|
|
|
+ this.getOrderDetails()
|
|
|
this.dialogFormVisible = true
|
|
|
},
|
|
|
close() {
|
|
|
@@ -106,7 +236,7 @@
|
|
|
save() {
|
|
|
this.$refs['form'].validate(async (valid) => {
|
|
|
if (valid) {
|
|
|
- let params = Object.assign(this.form, { planId: this.planId })
|
|
|
+ let params = Object.assign(this.form, { planId: this.planId, deliverOrderId: this.orderId })
|
|
|
params.startDate = this.form.date[0]
|
|
|
params.endDate = this.form.date[1]
|
|
|
if (this.workId) {
|
|
|
@@ -114,8 +244,38 @@
|
|
|
const { msg } = await deliverWorkApi.update(params)
|
|
|
this.$baseMessage(msg, 'success', 'vab-hey-message-success')
|
|
|
} else {
|
|
|
- const { msg } = await deliverWorkApi.add(params)
|
|
|
- this.$baseMessage(msg, 'success', 'vab-hey-message-success')
|
|
|
+ if (params.progressType == '10') {
|
|
|
+ if (!this.$refs.productTable.selection || this.$refs.productTable.selection == 0) {
|
|
|
+ this.$baseMessage('未选中任何产品', 'error', 'vab-hey-message-error')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for (let p of this.$refs.productTable.selection) {
|
|
|
+ if (p.operateType == '') {
|
|
|
+ this.$baseMessage('获取方式未选择', 'error', 'vab-hey-message-error')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let data = {
|
|
|
+ progress: params,
|
|
|
+ products: this.$refs.productTable.selection,
|
|
|
+ }
|
|
|
+ const { msg } = await deliverWorkApi.startDeliverGoodsProgress(data)
|
|
|
+ this.$baseMessage(msg, 'success', 'vab-hey-message-success')
|
|
|
+ } else if (params.progressType == '30') {
|
|
|
+ if (!this.$refs.productTable.selection || this.$refs.productTable.selection == 0) {
|
|
|
+ this.$baseMessage('未选中任何产品', 'error', 'vab-hey-message-error')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let data = {
|
|
|
+ progress: params,
|
|
|
+ products: this.$refs.productTable.selection,
|
|
|
+ }
|
|
|
+ const { msg } = await deliverWorkApi.startInstallProgress(data)
|
|
|
+ this.$baseMessage(msg, 'success', 'vab-hey-message-success')
|
|
|
+ } else {
|
|
|
+ const { msg } = await deliverWorkApi.add(params)
|
|
|
+ this.$baseMessage(msg, 'success', 'vab-hey-message-success')
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
this.$emit('fetch-data')
|
|
|
@@ -123,6 +283,91 @@
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ // 查看附件
|
|
|
+ showFile(url, fileName) {
|
|
|
+ const xhr = new XMLHttpRequest()
|
|
|
+ xhr.open('GET', url, true)
|
|
|
+ xhr.responseType = 'blob' // 通过文件下载url拿到对应的blob对象
|
|
|
+ xhr.onload = () => {
|
|
|
+ if (xhr.status === 200) {
|
|
|
+ let link = document.createElement('a')
|
|
|
+ let body = document.querySelector('body')
|
|
|
+ link.href = window.URL.createObjectURL(xhr.response)
|
|
|
+ link.download = fileName
|
|
|
+ link.click()
|
|
|
+ this.$message.success('下载成功')
|
|
|
+ body.removeChild(link)
|
|
|
+ window.URL.revokeObjectURL(link.href)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ xhr.send()
|
|
|
+ },
|
|
|
+ // 打开选择用户信息
|
|
|
+ openUser(multiple, property, label) {
|
|
|
+ this.multiple = multiple
|
|
|
+ this.property = property
|
|
|
+ this.label = label
|
|
|
+ if (this.form[property].length) {
|
|
|
+ this.$refs.user.ids = this.form[property]
|
|
|
+ } else if (this.form[property]) {
|
|
|
+ this.$refs.user.ids = [this.form[property]]
|
|
|
+ } else {
|
|
|
+ this.$refs.user.ids = []
|
|
|
+ }
|
|
|
+ this.$refs.user.open()
|
|
|
+ },
|
|
|
+ // 获取用户信息
|
|
|
+ getUser(userList, property, label) {
|
|
|
+ this.form[label] = userList.map((item) => item.nickName).join()
|
|
|
+ if (this.multiple) {
|
|
|
+ this.form[property] = userList.map((item) => item.id)
|
|
|
+ } else {
|
|
|
+ this.form[property] = userList[0] ? userList[0].id : ''
|
|
|
+ }
|
|
|
+ this.$forceUpdate()
|
|
|
+ },
|
|
|
+ async getOrderDetails() {
|
|
|
+ this.products = []
|
|
|
+ this.allProducts = []
|
|
|
+ this.deliverProducts = []
|
|
|
+ this.installProducts = []
|
|
|
+ this.selfProducts = []
|
|
|
+ this.productEditable = false
|
|
|
+ const [err, res] = await to(orderWorkApi.getDeliverOrder({ id: this.orderId }))
|
|
|
+ if (err) return
|
|
|
+ if (res.code == 200 && res.data) {
|
|
|
+ this.allProducts = res.data.product
|
|
|
+ }
|
|
|
+ for (let p of this.allProducts) {
|
|
|
+ p = JSON.parse(JSON.stringify(p))
|
|
|
+ if (p.isDeliver != '20') {
|
|
|
+ this.deliverProducts.push(p)
|
|
|
+ }
|
|
|
+ // 10发货任务单/20组装任务单/30部署安装单
|
|
|
+ if (
|
|
|
+ (p.deliverProgressId && p.deliverProgressId != 0 && this.form.progressType == '10') ||
|
|
|
+ (p.assembleProgressId && p.assembleProgressId != 0 && this.form.progressType == '20') ||
|
|
|
+ (p.installProgressId && p.installProgressId != 0 && this.form.progressType == '30')
|
|
|
+ ) {
|
|
|
+ this.selfProducts.push(p)
|
|
|
+ }
|
|
|
+ if (p.isComplete == '20') {
|
|
|
+ this.installProducts.push(p)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.$forceUpdate()
|
|
|
+ if (this.workId != 0) {
|
|
|
+ this.products = this.selfProducts
|
|
|
+ } else {
|
|
|
+ if (this.form.progressType == '10') {
|
|
|
+ this.productEditable = true
|
|
|
+ this.products = this.deliverProducts
|
|
|
+ } else if (this.form.progressType == '30') {
|
|
|
+ this.products = this.installProducts
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
}
|
|
|
</script>
|