|
@@ -12,14 +12,20 @@
|
|
|
<HcStartWorkForm v-if="taskInfo.meterType === 3" :table="tableInfo" :info="taskInfo" :is-edit="isEdits" />
|
|
|
<HcAlterForm v-if="taskInfo.meterType === 4" :table="tableInfo" :info="taskInfo" :is-edit="isEdits" />
|
|
|
<hc-card-item class="hc-card-footer mt-3">
|
|
|
- <div class="relative">
|
|
|
- <el-radio-group v-model="approval" size="large">
|
|
|
+ <template #header>
|
|
|
+ <el-radio-group v-model="taskForm.auditStatus" size="large">
|
|
|
<el-radio :label="1">同意</el-radio>
|
|
|
<el-radio :label="2">驳回</el-radio>
|
|
|
</el-radio-group>
|
|
|
- </div>
|
|
|
- <div class="relative mt-2">
|
|
|
- <el-input v-model="remark" :autosize="{ minRows: 2, maxRows: 4 }" type="textarea" placeholder="请描述废除整条任务的原因" />
|
|
|
+ </template>
|
|
|
+ <template #extra>
|
|
|
+ <el-link type="primary" :disabled="taskForm.auditStatus === 0" @click="tableSubmitClick">
|
|
|
+ <hc-icon name="check" />
|
|
|
+ <span class="ml-1">这里点提交</span>
|
|
|
+ </el-link>
|
|
|
+ </template>
|
|
|
+ <div class="relative">
|
|
|
+ <el-input v-model="taskForm.repealDesc" :autosize="{ minRows: 2, maxRows: 4 }" type="textarea" placeholder="请描述废除整条任务的原因" />
|
|
|
</div>
|
|
|
</hc-card-item>
|
|
|
</div>
|
|
@@ -27,6 +33,7 @@
|
|
|
|
|
|
<script setup>
|
|
|
import { onMounted, ref, watch } from 'vue'
|
|
|
+import { useAppStore } from '~src/store'
|
|
|
import HcMiddlepayForm from './middlepay-form.vue'
|
|
|
import HcMassForm from './mass-form.vue'
|
|
|
import HcStartWorkForm from './start-work-form.vue'
|
|
@@ -49,6 +56,15 @@ const props = defineProps({
|
|
|
},
|
|
|
})
|
|
|
|
|
|
+//事件
|
|
|
+const emit = defineEmits(['finish'])
|
|
|
+
|
|
|
+const useAppState = useAppStore()
|
|
|
+const projectId = ref(useAppState.getProjectId || '')
|
|
|
+const contractId = ref(useAppState.getContractId || '')
|
|
|
+const taskInfo = ref(props.info)
|
|
|
+const tableInfo = ref(props.table)
|
|
|
+
|
|
|
//监听可否编辑
|
|
|
const isEdits = ref(props.isEdit)
|
|
|
watch(() => props.isEdit, (val) => {
|
|
@@ -60,25 +76,46 @@ watch(() => [
|
|
|
props.table,
|
|
|
props.info,
|
|
|
], ([table, row]) => {
|
|
|
- setTaskInfo(table, row)
|
|
|
+ tableInfo.value = table
|
|
|
+ taskInfo.value = row
|
|
|
+ taskForm.value = { auditStatus: table.status ?? 0, repealDesc: table.repealDesc ?? '' }
|
|
|
}, { deep: true })
|
|
|
|
|
|
//渲染完成
|
|
|
onMounted(() => {
|
|
|
- setTaskInfo(props.table, props.info)
|
|
|
+ const { status, repealDesc } = tableInfo.value
|
|
|
+ taskForm.value = { auditStatus: status ?? 0, repealDesc: repealDesc ?? '' }
|
|
|
})
|
|
|
|
|
|
-//设置任务信息
|
|
|
-const taskInfo = ref({})
|
|
|
-const tableInfo = ref({})
|
|
|
-const setTaskInfo = async (table, row) => {
|
|
|
- tableInfo.value = table
|
|
|
- taskInfo.value = row
|
|
|
-}
|
|
|
+//审批表单
|
|
|
+const taskForm = ref({ auditStatus: 0, repealDesc: '' })
|
|
|
|
|
|
-//同意还是驳回
|
|
|
-const approval = ref('')
|
|
|
-const remark = ref('')
|
|
|
+//单条提交
|
|
|
+const tableSubmitClick = async () => {
|
|
|
+ const { auditStatus, repealDesc } = taskForm.value
|
|
|
+ if (auditStatus === 0) {
|
|
|
+ window.$message.error('请先选择同意或驳回')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (auditStatus === 2 && !repealDesc) {
|
|
|
+ window.$message.error('请先填写驳回原因')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ //发起请求
|
|
|
+ const { error, code, msg } = await mainApi.taskAudit({
|
|
|
+ ...taskForm.value,
|
|
|
+ dataId: tableInfo.value.id,
|
|
|
+ taskId: taskInfo.value.id,
|
|
|
+ projectId: projectId.value,
|
|
|
+ contractId: contractId.value,
|
|
|
+ })
|
|
|
+ if (!error && code === 200) {
|
|
|
+ window.$message.success('提交成功')
|
|
|
+ emit('finish')
|
|
|
+ } else {
|
|
|
+ window.$message.error(msg ?? '提交失败')
|
|
|
+ }
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|