Commit bd9b16deba9342a608e52cf7decab9e74a27059b

Authored by gesilong
1 parent 4f015bcc

commit:化验送样单模块联调

  1 +import request from '@/utils/request'
  2 +import { ContentTypeEnum } from '@/utils/httpEnum'
  3 +
  4 +// 化验送样单(对齐 PC 端 api/warehouse-manage/sample-submission)
  5 +const baseUrl = '/procurement/assay/apply'
  6 +
  7 +/**
  8 + * 分页查询化验送样单列表
  9 + * params: pageIndex, pageSize, weighingTicketCode, productName,
  10 + * planCode, approvalStatus, createBy, deleted(boolean)
  11 + */
  12 +export function assayApplyQueryApi(params) {
  13 + return request({
  14 + url: baseUrl + '/query',
  15 + method: 'get',
  16 + params
  17 + })
  18 +}
  19 +
  20 +/**
  21 + * 分页查询可选过磅码单列表(码单编号选择)
  22 + * params: pageIndex, pageSize, code, workshopId
  23 + */
  24 +export function assayApplyTicketPageApi(params) {
  25 + return request({
  26 + url: baseUrl + '/ticketPage',
  27 + method: 'get',
  28 + params
  29 + })
  30 +}
  31 +
  32 +/**
  33 + * 根据过磅码单ID查询码单数据(含计划编号下拉选项 planOptions)
  34 + */
  35 +export function assayApplyTicketDataApi(ticketId) {
  36 + return request({
  37 + url: baseUrl + '/ticketData',
  38 + method: 'get',
  39 + params: { ticketId }
  40 + })
  41 +}
  42 +
  43 +/**
  44 + * 根据过磅码单与采购计划查询过磅品种下拉选项
  45 + * params: { ticketId(可选), planId }
  46 + */
  47 +export function assayApplyBreedOptionsApi(params) {
  48 + return request({
  49 + url: baseUrl + '/breedOptions',
  50 + method: 'get',
  51 + params
  52 + })
  53 +}
  54 +
  55 +/**
  56 + * 新增化验送样单
  57 + * data: { weighingTicketId, procurementPlanId, productId, department }
  58 + */
  59 +export function assayApplyCreateApi(data) {
  60 + return request({
  61 + url: baseUrl,
  62 + method: 'post',
  63 + data,
  64 + contentType: ContentTypeEnum.JSON
  65 + })
  66 +}
  67 +
  68 +/**
  69 + * 查询化验送样单详情
  70 + */
  71 +export function assayApplyDetailApi(params) {
  72 + return request({
  73 + url: baseUrl,
  74 + method: 'get',
  75 + params
  76 + })
  77 +}
  78 +
  79 +/**
  80 + * 修改化验送样单
  81 + * data: { id, weighingTicketId, procurementPlanId, productId, department }
  82 + */
  83 +export function assayApplyUpdateApi(data) {
  84 + return request({
  85 + url: baseUrl,
  86 + method: 'put',
  87 + data,
  88 + contentType: ContentTypeEnum.JSON
  89 + })
  90 +}
  91 +
  92 +/**
  93 + * 提交审核
  94 + */
  95 +export function assayApplySubmitApi(id) {
  96 + return request({
  97 + url: baseUrl + '/submit?id=' + id,
  98 + method: 'put'
  99 + })
  100 +}
  101 +
  102 +/**
  103 + * 取消化验送样单
  104 + */
  105 +export function assayApplyCancelApi(id) {
  106 + return request({
  107 + url: baseUrl + '/cancel?id=' + id,
  108 + method: 'put'
  109 + })
  110 +}
@@ -589,6 +589,38 @@ @@ -589,6 +589,38 @@
589 } 589 }
590 }, 590 },
591 { 591 {
  592 + "path": "pages/sample-submission/index",
  593 + "style": {
  594 + "navigationBarTitleText": "化验送样单",
  595 + "navigationBarBackgroundColor": "#ffffff",
  596 + "navigationBarTextStyle": "black"
  597 + }
  598 + },
  599 + {
  600 + "path": "pages/sample-submission/add",
  601 + "style": {
  602 + "navigationBarTitleText": "新增化验送样单",
  603 + "navigationBarBackgroundColor": "#ffffff",
  604 + "navigationBarTextStyle": "black"
  605 + }
  606 + },
  607 + {
  608 + "path": "pages/sample-submission/detail",
  609 + "style": {
  610 + "navigationBarTitleText": "化验送样单详情",
  611 + "navigationBarBackgroundColor": "#ffffff",
  612 + "navigationBarTextStyle": "black"
  613 + }
  614 + },
  615 + {
  616 + "path": "pages/sample-submission/modify",
  617 + "style": {
  618 + "navigationBarTitleText": "编辑化验送样单",
  619 + "navigationBarBackgroundColor": "#ffffff",
  620 + "navigationBarTextStyle": "black"
  621 + }
  622 + },
  623 + {
592 "path": "pages/order_list/index", 624 "path": "pages/order_list/index",
593 "style": { 625 "style": {
594 "navigationBarTitleText": "订货单列表", 626 "navigationBarTitleText": "订货单列表",
  1 +<template>
  2 + <view class="page">
  3 + <scroll-view class="scroll" scroll-y>
  4 + <uni-list>
  5 + <!-- 码单编号(弹窗选择) -->
  6 + <uni-list-item class="select-item" :class="form.weighingTicketCode ? 'is-filled' : 'is-empty'" clickable
  7 + @click="openTicketSheet" :rightText="form.weighingTicketCode || '请选择码单'" showArrow>
  8 + <template v-slot:body>
  9 + <view class="item-title"><text class="required">*</text><text>码单编号</text></view>
  10 + </template>
  11 + </uni-list-item>
  12 +
  13 + <!-- 计划编号 -->
  14 + <uni-list-item class="select-item" :class="form.procurementPlanId ? 'is-filled' : 'is-empty'">
  15 + <template v-slot:body>
  16 + <view class="item-title"><text class="required">*</text><text>计划编号</text></view>
  17 + </template>
  18 + <template v-slot:footer>
  19 + <picker mode="selector" :range="planLabels" @change="onPlanChange" :disabled="!planOptions.length">
  20 + <view class="picker-value" :class="{ placeholder: !form.procurementPlanId }">
  21 + {{ getPlanLabel() || '请选择计划编号' }}
  22 + </view>
  23 + </picker>
  24 + </template>
  25 + </uni-list-item>
  26 +
  27 + <!-- 品种 -->
  28 + <uni-list-item class="select-item" :class="form.productId ? 'is-filled' : 'is-empty'">
  29 + <template v-slot:body>
  30 + <view class="item-title"><text class="required">*</text><text>品种</text></view>
  31 + </template>
  32 + <template v-slot:footer>
  33 + <picker mode="selector" :range="productLabels" @change="onProductChange" :disabled="!productOptions.length">
  34 + <view class="picker-value" :class="{ placeholder: !form.productId }">
  35 + {{ getProductLabel() || '请选择品种' }}
  36 + </view>
  37 + </picker>
  38 + </template>
  39 + </uni-list-item>
  40 +
  41 + <!-- 科室 -->
  42 + <uni-list-item class="select-item" :class="form.department ? 'is-filled' : 'is-empty'">
  43 + <template v-slot:body>
  44 + <view class="item-title"><text class="required">*</text><text>科室</text></view>
  45 + </template>
  46 + <template v-slot:footer>
  47 + <picker mode="selector" :range="departmentLabels" @change="onDepartmentChange">
  48 + <view class="picker-value" :class="{ placeholder: !form.department }">
  49 + {{ getDepartmentLabel() || '请选择科室' }}
  50 + </view>
  51 + </picker>
  52 + </template>
  53 + </uni-list-item>
  54 + </uni-list>
  55 +
  56 + <view class="footer">
  57 + <button class="btn submit" type="primary" @click="onSubmit">保存</button>
  58 + </view>
  59 + </scroll-view>
  60 +
  61 + <RelateSelectSheet :visible.sync="ticketSheet.visible" title="选择码单" :multiple="false"
  62 + :fetchFn="ticketSheet.fetchFn" :display-fields="ticketSheet.displayFields"
  63 + row-key="id" :selectedKeys.sync="ticketSheet.selectedKeys" @confirm="onTicketConfirm" />
  64 + </view>
  65 +</template>
  66 +
  67 +<script>
  68 +import RelateSelectSheet from '@/components/relate-select/index.vue'
  69 +import {
  70 + assayApplyTicketPageApi,
  71 + assayApplyTicketDataApi,
  72 + assayApplyBreedOptionsApi,
  73 + assayApplyCreateApi
  74 +} from '@/api/procure-manage/assayApply.js'
  75 +import { getDicByCodes } from '@/utils/dic.js'
  76 +
  77 +export default {
  78 + name: 'AddSampleSubmission',
  79 + components: { RelateSelectSheet },
  80 + data() {
  81 + return {
  82 + form: {
  83 + weighingTicketId: '',
  84 + weighingTicketCode: '',
  85 + procurementPlanId: '',
  86 + productId: '',
  87 + department: ''
  88 + },
  89 + dicOptions: { DEPARTMENT: [] },
  90 + // 计划编号下拉选项(所选码单下的计划)
  91 + planOptions: [],
  92 + // 品种下拉选项(所选计划下的过磅品种)
  93 + productOptions: [],
  94 + ticketSheet: {
  95 + visible: false,
  96 + fetchFn: null,
  97 + displayFields: [
  98 + { label: '码单编号', field: 'code' },
  99 + { label: '分厂', field: 'workshopName' },
  100 + { label: '创建人', field: 'createBy' },
  101 + { label: '创建时间', field: 'createTime' }
  102 + ],
  103 + selectedKeys: []
  104 + }
  105 + }
  106 + },
  107 + computed: {
  108 + planLabels() {
  109 + return (this.planOptions || []).map(it => it.label)
  110 + },
  111 + productLabels() {
  112 + return (this.productOptions || []).map(it => it.label)
  113 + },
  114 + departmentLabels() {
  115 + return (this.dicOptions.DEPARTMENT || []).map(it => it.name)
  116 + }
  117 + },
  118 + created() {
  119 + this.ticketSheet.fetchFn = this.fetchTickets.bind(this)
  120 + this.loadDicData()
  121 + },
  122 + methods: {
  123 + async loadDicData() {
  124 + try {
  125 + const results = await getDicByCodes(['DEPARTMENT'])
  126 + this.dicOptions.DEPARTMENT = (results.DEPARTMENT && results.DEPARTMENT.data) || []
  127 + } catch (e) {
  128 + this.dicOptions.DEPARTMENT = []
  129 + }
  130 + },
  131 + // 码单选择弹窗数据源(可选过磅码单分页)
  132 + fetchTickets({ pageIndex, pageSize, extra }) {
  133 + const keyword = (extra && extra.keyword) || ''
  134 + const params = {
  135 + pageIndex,
  136 + pageSize,
  137 + code: keyword || undefined
  138 + }
  139 + return assayApplyTicketPageApi(params).then(res => {
  140 + const _data = (res && res.data) || {}
  141 + const records = _data.datas || _data.list || _data.records || []
  142 + const totalCount = _data.totalCount || _data.count || 0
  143 + const hasNext = _data.hasNext || false
  144 + return { records, totalCount, hasNext }
  145 + }).catch(() => ({ records: [], totalCount: 0, hasNext: false }))
  146 + },
  147 + openTicketSheet() {
  148 + this.ticketSheet.selectedKeys = this.form.weighingTicketId ? [this.form.weighingTicketId] : []
  149 + this.ticketSheet.visible = true
  150 + },
  151 + // 码单选择回调:联动刷新计划编号下拉并重置品种
  152 + onTicketConfirm({ items }) {
  153 + const row = (items || [])[0]
  154 + if (!row) {
  155 + this.resetDownStream()
  156 + return
  157 + }
  158 + this.form.weighingTicketId = row.id || ''
  159 + this.form.weighingTicketCode = row.code || ''
  160 + this.resetDownStream()
  161 + this.loadPlanOptions(row.id)
  162 + },
  163 + resetDownStream() {
  164 + this.form.procurementPlanId = ''
  165 + this.form.productId = ''
  166 + this.planOptions = []
  167 + this.productOptions = []
  168 + },
  169 + // 根据所选码单加载计划编号下拉选项
  170 + loadPlanOptions(ticketId) {
  171 + assayApplyTicketDataApi(ticketId)
  172 + .then(res => {
  173 + const data = (res && res.data) || {}
  174 + this.planOptions = ((data && data.planOptions) || []).map(item => ({
  175 + label: item.planCode,
  176 + value: item.planId
  177 + }))
  178 + })
  179 + .catch(() => {
  180 + this.planOptions = []
  181 + })
  182 + },
  183 + getPlanLabel() {
  184 + const found = (this.planOptions || []).find(it => it.value === this.form.procurementPlanId)
  185 + return found ? found.label : ''
  186 + },
  187 + // 计划编号改选后:重置品种并按所选计划刷新过磅品种下拉
  188 + onPlanChange(e) {
  189 + const opt = (this.planOptions || [])[Number(e.detail.value)]
  190 + if (!opt) return
  191 + this.form.procurementPlanId = opt.value
  192 + this.form.productId = ''
  193 + this.productOptions = []
  194 + assayApplyBreedOptionsApi({
  195 + ticketId: this.form.weighingTicketId || undefined,
  196 + planId: opt.value
  197 + })
  198 + .then(res => {
  199 + const list = (res && res.data) || []
  200 + this.productOptions = (list || []).map(item => ({
  201 + label: item.productName,
  202 + value: item.productId
  203 + }))
  204 + })
  205 + .catch(() => {
  206 + this.productOptions = []
  207 + })
  208 + },
  209 + getProductLabel() {
  210 + const found = (this.productOptions || []).find(it => it.value === this.form.productId)
  211 + return found ? found.label : ''
  212 + },
  213 + onProductChange(e) {
  214 + const opt = (this.productOptions || [])[Number(e.detail.value)]
  215 + if (!opt) return
  216 + this.form.productId = opt.value
  217 + },
  218 + getDepartmentLabel() {
  219 + const found = (this.dicOptions.DEPARTMENT || []).find(it => String(it.code) === String(this.form.department))
  220 + return found ? found.name : ''
  221 + },
  222 + onDepartmentChange(e) {
  223 + const opt = (this.dicOptions.DEPARTMENT || [])[Number(e.detail.value)]
  224 + if (!opt) return
  225 + this.form.department = opt.code != null ? String(opt.code) : ''
  226 + },
  227 + validate() {
  228 + const f = this.form
  229 + if (!f.weighingTicketId) return this.tip('请选择码单编号')
  230 + if (!f.procurementPlanId) return this.tip('请选择计划编号')
  231 + if (!f.productId) return this.tip('请选择品种')
  232 + if (!f.department) return this.tip('请选择科室')
  233 + return true
  234 + },
  235 + tip(msg) {
  236 + uni.showToast({ title: msg, icon: 'none' })
  237 + return false
  238 + },
  239 + async onSubmit() {
  240 + if (!this.validate()) return
  241 + const confirmRes = await new Promise(resolve => {
  242 + uni.showModal({ title: '提示', content: '确定保存化验送样单吗?', confirmText: '确定', cancelText: '取消', success: resolve })
  243 + })
  244 + if (!(confirmRes && confirmRes.confirm)) return
  245 + uni.showLoading({ title: '提交中...', mask: true })
  246 + assayApplyCreateApi({
  247 + weighingTicketId: this.form.weighingTicketId,
  248 + procurementPlanId: this.form.procurementPlanId,
  249 + productId: this.form.productId,
  250 + department: this.form.department
  251 + })
  252 + .then(() => {
  253 + uni.hideLoading()
  254 + uni.showToast({ title: '保存成功', icon: 'none' })
  255 + try { uni.setStorageSync('SAMPLE_SUBMISSION_LIST_NEED_REFRESH', '1') } catch (e) {}
  256 + setTimeout(() => { uni.navigateBack() }, 400)
  257 + })
  258 + .catch(e => {
  259 + uni.hideLoading()
  260 + uni.showToast({ title: (e && (e.msg || e.message)) || '保存失败', icon: 'none' })
  261 + })
  262 + }
  263 + }
  264 +}
  265 +</script>
  266 +
  267 +<style lang="scss" scoped>
  268 +.page {
  269 + display: flex;
  270 + flex-direction: column;
  271 + height: 100%;
  272 +}
  273 +
  274 +.scroll {
  275 + flex: 1;
  276 + padding: 12rpx 0 200rpx !important;
  277 +}
  278 +
  279 +.footer {
  280 + z-index: 2;
  281 + position: fixed;
  282 + left: 0;
  283 + right: 0;
  284 + bottom: 0;
  285 + padding: 32rpx;
  286 + padding-bottom: calc(32rpx + env(safe-area-inset-bottom));
  287 + background: #fff;
  288 + box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06);
  289 +
  290 + .btn {
  291 + height: 80rpx;
  292 + line-height: 80rpx;
  293 + border-radius: 12rpx;
  294 + font-size: 32rpx;
  295 + }
  296 +
  297 + .submit {
  298 + background: $theme-primary;
  299 + color: #fff;
  300 + }
  301 +}
  302 +
  303 +::v-deep .uni-list {
  304 + .uni-easyinput {
  305 + display: flex;
  306 +
  307 + .uni-input-input {
  308 + color: rgba(0, 0, 0, 0.9);
  309 + }
  310 + }
  311 +
  312 + .uni-input-placeholder {
  313 + z-index: 1;
  314 + }
  315 +
  316 + .uni-input-input {
  317 + background-color: #ffffff;
  318 + }
  319 +
  320 + background: transparent;
  321 +
  322 + &-item {
  323 + &__extra-text {
  324 + font-size: 32rpx;
  325 + }
  326 +
  327 + &__content-title {
  328 + font-size: 32rpx;
  329 + color: rgba(0, 0, 0, 0.9);
  330 + }
  331 +
  332 + &__container {
  333 + padding: 32rpx;
  334 +
  335 + .item-title,
  336 + .uni-list-item__content {
  337 + flex: none;
  338 + min-height: 48rpx;
  339 + line-height: 48rpx;
  340 + font-size: 32rpx;
  341 + position: relative;
  342 + width: 240rpx;
  343 + margin-right: 32rpx;
  344 + color: rgba(0, 0, 0, 0.9);
  345 +
  346 + .required {
  347 + color: red;
  348 + position: absolute;
  349 + top: 50%;
  350 + transform: translateY(-50%);
  351 + left: -16rpx;
  352 + }
  353 + }
  354 + }
  355 +
  356 + &.select-item {
  357 + &.is-empty {
  358 + .uni-list-item__extra-text {
  359 + color: rgba(0, 0, 0, 0.4) !important;
  360 + }
  361 + }
  362 +
  363 + &.is-filled {
  364 + .uni-list-item__extra-text {
  365 + color: rgba(0, 0, 0, 0.9) !important;
  366 + }
  367 + }
  368 + }
  369 + }
  370 +}
  371 +
  372 +.picker-value {
  373 + font-size: 32rpx;
  374 + color: rgba(0, 0, 0, 0.9);
  375 + line-height: 48rpx;
  376 + text-align: right;
  377 + min-height: 48rpx;
  378 +
  379 + &.placeholder {
  380 + color: rgba(0, 0, 0, 0.4);
  381 + }
  382 +}
  383 +</style>
  1 +<template>
  2 + <view class="page">
  3 + <scroll-view class="scroll" scroll-y>
  4 + <view class="detail-page">
  5 + <!-- 基础信息 -->
  6 + <view class="section">
  7 + <text class="row company">{{ safeText(form.weighingTicketCode) }}</text>
  8 + <view class="row"><text class="label">计划编号</text><text class="value">{{ safeText(form.planCode) }}</text></view>
  9 + <view class="row"><text class="label">品种</text><text class="value">{{ safeText(form.productName) }}</text></view>
  10 + <view class="row"><text class="label">科室</text><text class="value">{{ departmentName }}</text></view>
  11 + <view class="row"><text class="label">审核状态</text><text class="value">{{ approvalStatusName }}</text></view>
  12 + <view class="row"><text class="label">创建人</text><text class="value">{{ safeText(form.createBy) }}</text></view>
  13 + <view class="row"><text class="label">创建时间</text><text class="value">{{ safeText(form.createTime) }}</text></view>
  14 + </view>
  15 + </view>
  16 + </scroll-view>
  17 + <detail-buttons :buttons="displayButtons" @click="handleButtonClick" />
  18 + </view>
  19 +</template>
  20 +
  21 +<script>
  22 +import DetailButtons from '@/components/detail-buttons/index.vue'
  23 +import { getDicByCodes, getDicName } from '@/utils/dic.js'
  24 +import {
  25 + assayApplyDetailApi,
  26 + assayApplySubmitApi,
  27 + assayApplyCancelApi
  28 +} from '@/api/procure-manage/assayApply.js'
  29 +import { getInfo } from '@/api/login.js'
  30 +
  31 +export default {
  32 + name: 'SampleSubmissionDetail',
  33 + components: { DetailButtons },
  34 + data() {
  35 + return {
  36 + id: '',
  37 + form: {},
  38 + currentUserId: '',
  39 + dicOptions: {
  40 + DEPARTMENT: [],
  41 + AUDIT_STATUS: []
  42 + },
  43 + buttons: [
  44 + { text: '修改', visible: true, variant: 'outline', event: 'edit' },
  45 + { text: '提交审核', visible: true, variant: 'outline', event: 'submitAudit' },
  46 + { text: '审核', visible: true, variant: 'primary', event: 'audit' },
  47 + { text: '审核详情', visible: true, variant: 'outline', event: 'auditDetail' },
  48 + { text: '取消', visible: true, variant: 'outline', event: 'cancel' }
  49 + ]
  50 + }
  51 + },
  52 + computed: {
  53 + departmentName() {
  54 + const v = this.form.department == null ? '' : String(this.form.department)
  55 + if (!v) return '-'
  56 + return getDicName('DEPARTMENT', v, this.dicOptions.DEPARTMENT) || v
  57 + },
  58 + approvalStatusName() {
  59 + const v = this.form.approvalStatus == null ? '' : String(this.form.approvalStatus)
  60 + if (!v) return '-'
  61 + return getDicName('AUDIT_STATUS', v, this.dicOptions.AUDIT_STATUS) || v
  62 + },
  63 + displayButtons() {
  64 + const status = this.form.approvalStatus || ''
  65 + const isMine = this.form.createById === this.currentUserId
  66 + const isPass = status === 'PASS'
  67 + const isAudit = status === 'AUDIT'
  68 + const canExamine = isAudit && this.form.showExamine === true
  69 + const canExamineDetail = this.form.showExamineDetail === true
  70 + const canEdit = (status === 'DRAFT' || status === 'REFUSE' || !status) && isMine
  71 + return [
  72 + {
  73 + ...this.buttons[0],
  74 + visible: canEdit && this.$auth.hasPermi('warehouse-manage:sample-submission:modify')
  75 + },
  76 + {
  77 + ...this.buttons[1],
  78 + visible: canEdit && this.$auth.hasPermi('warehouse-manage:sample-submission:submit')
  79 + },
  80 + {
  81 + ...this.buttons[2],
  82 + visible: canExamine && this.$auth.hasPermi('warehouse-manage:sample-submission:approve')
  83 + },
  84 + {
  85 + ...this.buttons[3],
  86 + visible: canExamineDetail && this.$auth.hasPermi('warehouse-manage:sample-submission:review')
  87 + },
  88 + {
  89 + ...this.buttons[4],
  90 + visible: (status === 'DRAFT' || status === 'REFUSE') && this.$auth.hasPermi('warehouse-manage:sample-submission:cancel')
  91 + }
  92 + ]
  93 + }
  94 + },
  95 + onLoad(query) {
  96 + this.id = (query && query.id) || ''
  97 + this.loadDicData()
  98 + this.loadDetail()
  99 + this.getUserInfo()
  100 + },
  101 + onShow() {
  102 + let needRefresh = ''
  103 + try { needRefresh = uni.getStorageSync('SAMPLE_SUBMISSION_DETAIL_NEED_REFRESH') } catch (e) {}
  104 + if (!needRefresh) return
  105 + try { uni.removeStorageSync('SAMPLE_SUBMISSION_DETAIL_NEED_REFRESH') } catch (e) {}
  106 + this.loadDetail()
  107 + },
  108 + methods: {
  109 + async loadDicData() {
  110 + try {
  111 + const results = await getDicByCodes(['DEPARTMENT', 'AUDIT_STATUS'])
  112 + this.dicOptions.DEPARTMENT = (results.DEPARTMENT && results.DEPARTMENT.data) || []
  113 + this.dicOptions.AUDIT_STATUS = (results.AUDIT_STATUS && results.AUDIT_STATUS.data) || []
  114 + } catch (e) {
  115 + this.dicOptions = { DEPARTMENT: [], AUDIT_STATUS: [] }
  116 + }
  117 + },
  118 + async getUserInfo() {
  119 + try {
  120 + const res = await getInfo()
  121 + this.currentUserId = (res && (res.id || (res.data && res.data.id))) || ''
  122 + } catch (e) {
  123 + this.currentUserId = ''
  124 + }
  125 + },
  126 + loadDetail() {
  127 + if (!this.id) {
  128 + uni.showToast({ title: '缺少单据ID', icon: 'none' })
  129 + return
  130 + }
  131 + uni.showLoading && uni.showLoading({ title: '加载中...', mask: true })
  132 + assayApplyDetailApi({ id: this.id })
  133 + .then(res => {
  134 + const data = res && res.data ? res.data : {}
  135 + this.form = Object.assign({}, data)
  136 + })
  137 + .catch(() => {
  138 + uni.showToast({ title: '详情加载失败', icon: 'none' })
  139 + })
  140 + .finally(() => {
  141 + uni.hideLoading && uni.hideLoading()
  142 + })
  143 + },
  144 + handleButtonClick(btn) {
  145 + if (!btn || btn.disabled || !btn.visible) return
  146 + const e = btn.event || ''
  147 + if (e === 'edit') return this.onEdit()
  148 + if (e === 'submitAudit') return this.onSubmitAudit()
  149 + if (e === 'audit') return this.onAudit()
  150 + if (e === 'auditDetail') return this.onAuditDetail()
  151 + if (e === 'cancel') return this.onCancel()
  152 + },
  153 + onEdit() {
  154 + uni.navigateTo({ url: '/pages/sample-submission/modify?id=' + this.id })
  155 + },
  156 + onAudit() {
  157 + const id = this.id || (this.form && this.form.id) || ''
  158 + if (!id) return
  159 + uni.setStorageSync('contractType', 'ASSAY_APPLY')
  160 + uni.setStorageSync('sourceBusinessId', id)
  161 + uni.navigateTo({ url: '/pages/flow/audit' })
  162 + },
  163 + onAuditDetail() {
  164 + const id = this.id || (this.form && this.form.id) || ''
  165 + if (!id) return
  166 + uni.setStorageSync('contractType', 'ASSAY_APPLY')
  167 + uni.setStorageSync('sourceBusinessId', id)
  168 + uni.navigateTo({ url: '/pages/flow/audit_detail' })
  169 + },
  170 + refreshListFlags() {
  171 + try {
  172 + uni.setStorageSync('SAMPLE_SUBMISSION_LIST_NEED_REFRESH', '1')
  173 + uni.setStorageSync('SAMPLE_SUBMISSION_DETAIL_NEED_REFRESH', '1')
  174 + } catch (e) {}
  175 + },
  176 + runWithConfirm(opts) {
  177 + const title = opts.title || '提示'
  178 + const content = opts.content || ''
  179 + const run = opts.run
  180 + const loading = opts.loading || '处理中'
  181 + const successText = opts.successText || '操作成功'
  182 + const failText = opts.failText || '操作失败'
  183 + if (!this.id) {
  184 + uni.showToast({ title: '缺少单据ID', icon: 'none' })
  185 + return
  186 + }
  187 + uni.showModal({
  188 + title,
  189 + content,
  190 + confirmText: '确定',
  191 + cancelText: '取消',
  192 + success: res => {
  193 + if (!res || !res.confirm) return
  194 + uni.showLoading({ title: loading, mask: true })
  195 + Promise.resolve(run(this.id))
  196 + .then(() => {
  197 + uni.hideLoading()
  198 + uni.showToast({ title: successText, icon: 'none' })
  199 + this.refreshListFlags()
  200 + this.loadDetail()
  201 + })
  202 + .catch(e => {
  203 + uni.hideLoading()
  204 + uni.showToast({ title: (e && (e.msg || e.message)) || failText, icon: 'none' })
  205 + })
  206 + }
  207 + })
  208 + },
  209 + onSubmitAudit() {
  210 + this.runWithConfirm({
  211 + title: '提交审核',
  212 + content: '确认提交审核吗?',
  213 + loading: '提交中',
  214 + successText: '提交审核成功',
  215 + failText: '提交审核失败',
  216 + run: id => assayApplySubmitApi(id)
  217 + })
  218 + },
  219 + onCancel() {
  220 + this.runWithConfirm({
  221 + title: '取消',
  222 + content: '确认取消该化验送样单吗?',
  223 + loading: '处理中',
  224 + successText: '取消成功',
  225 + failText: '取消失败',
  226 + run: id => assayApplyCancelApi(id)
  227 + })
  228 + },
  229 + safeText(v) {
  230 + const s = v == null ? '' : String(v)
  231 + return s.trim() ? s : '-'
  232 + }
  233 + }
  234 +}
  235 +</script>
  236 +
  237 +<style lang="scss" scoped>
  238 +.page {
  239 + display: flex;
  240 + flex-direction: column;
  241 + height: 100%;
  242 +}
  243 +.scroll {
  244 + flex: 1;
  245 + padding: 8rpx 0 144rpx;
  246 +}
  247 +.detail-page {
  248 + background: #f3f3f3;
  249 +}
  250 +.section {
  251 + padding: 32rpx;
  252 + background: #fff;
  253 + margin-bottom: 20rpx;
  254 +}
  255 +.row {
  256 + display: flex;
  257 + margin-bottom: 28rpx;
  258 + &:last-child { margin-bottom: 0; }
  259 + &.company {
  260 + font-size: 36rpx;
  261 + font-weight: 600;
  262 + color: rgba(0, 0, 0, 0.9);
  263 + padding-top: 8rpx;
  264 + line-height: 50rpx;
  265 + }
  266 + .label {
  267 + max-width: 420rpx;
  268 + margin-right: 20rpx;
  269 + line-height: 32rpx;
  270 + font-size: 28rpx;
  271 + color: rgba(0, 0, 0, 0.6);
  272 + }
  273 + .value {
  274 + flex: 1;
  275 + line-height: 32rpx;
  276 + font-size: 28rpx;
  277 + color: rgba(0, 0, 0, 0.9);
  278 + text-align: right;
  279 + word-break: break-all;
  280 + }
  281 +}
  282 +</style>
  1 +<template>
  2 + <view class="page">
  3 + <view class="ticket-list-fixed">
  4 + <view class="search-row">
  5 + <uni-search-bar
  6 + v-model="searchKeyword"
  7 + radius="6"
  8 + placeholder="请输入码单编号"
  9 + clearButton="auto"
  10 + cancelButton="none"
  11 + bgColor="#F3F3F3"
  12 + textColor="rgba(0,0,0,0.4)"
  13 + @confirm="search"
  14 + @input="onSearchInput"
  15 + />
  16 + <view class="tool-icons">
  17 + <image
  18 + v-if="$auth.hasPermi('warehouse-manage:sample-submission:add')"
  19 + class="tool-icon"
  20 + src="/static/images/dev_manage/add_icon.png"
  21 + @click="onAdd"
  22 + />
  23 + <image class="tool-icon" src="/static/images/dev_manage/filter_icon.png" @click="openFilter" />
  24 + </view>
  25 + </view>
  26 +
  27 + <view class="tabs">
  28 + <view
  29 + v-for="(t, i) in tabs"
  30 + :key="i"
  31 + :class="['tab', { active: deleted === t.value }]"
  32 + @click="switchTab(t)"
  33 + >
  34 + {{ t.label }}
  35 + </view>
  36 + </view>
  37 + </view>
  38 +
  39 + <view class="list-box">
  40 + <card-list
  41 + ref="cardRef"
  42 + :fetch-fn="fetchList"
  43 + :query="query"
  44 + :extra="extraParams"
  45 + row-key="id"
  46 + :enable-refresh="true"
  47 + :enable-load-more="true"
  48 + @loaded="onCardLoaded"
  49 + @error="onCardError"
  50 + >
  51 + <template v-slot="{ item }">
  52 + <view class="card" @click="onCardClick(item)">
  53 + <view class="card-header">
  54 + <text class="title omit2">{{ item.weighingTicketCode || '-' }}</text>
  55 + <text :class="['status', `status_${item.approvalStatus}`]">{{ getAuditStatusText(item.approvalStatus) }}</text>
  56 + </view>
  57 + <view class="info-row">
  58 + <text>品种</text>
  59 + <text>{{ item.productName || '-' }}</text>
  60 + </view>
  61 + <view class="info-row">
  62 + <text>计划编号</text>
  63 + <text>{{ item.planCode || '-' }}</text>
  64 + </view>
  65 + <view class="info-row">
  66 + <text>创建人</text>
  67 + <text>{{ item.createBy || '-' }}</text>
  68 + </view>
  69 + <view class="info-row">
  70 + <text>时间</text>
  71 + <text>{{ item.createTime || '-' }}</text>
  72 + </view>
  73 + </view>
  74 + </template>
  75 + </card-list>
  76 + </view>
  77 +
  78 + <filter-modal
  79 + :visible.sync="filterVisible"
  80 + :value.sync="filterForm"
  81 + title="筛选"
  82 + @reset="onFilterReset"
  83 + @confirm="onFilterConfirm"
  84 + >
  85 + <template v-slot="{ model }">
  86 + <view class="filter-form">
  87 + <view class="form-item">
  88 + <view class="label">码单编号</view>
  89 + <input class="input" v-model="model.weighingTicketCode" placeholder="请输入码单编号" />
  90 + </view>
  91 + <view class="form-item">
  92 + <view class="label">品种</view>
  93 + <input class="input" v-model="model.productName" placeholder="请输入品种" />
  94 + </view>
  95 + <view class="form-item">
  96 + <view class="label">计划编号</view>
  97 + <input class="input" v-model="model.planCode" placeholder="请输入计划编号" />
  98 + </view>
  99 + <view class="form-item">
  100 + <view class="label">审核状态</view>
  101 + <uni-data-checkbox
  102 + mode="tag"
  103 + :multiple="false"
  104 + :value-field="'value'"
  105 + :text-field="'text'"
  106 + v-model="model.approvalStatus"
  107 + :localdata="approvalStatusOptions"
  108 + />
  109 + </view>
  110 + <view class="form-item">
  111 + <view class="label">创建人</view>
  112 + <input class="input" v-model="model.createBy" placeholder="请输入创建人" />
  113 + </view>
  114 + </view>
  115 + </template>
  116 + </filter-modal>
  117 + </view>
  118 +</template>
  119 +
  120 +<script>
  121 +import CardList from '@/components/card/index.vue'
  122 +import FilterModal from '@/components/filter/index.vue'
  123 +import { getDicByCodes, getDicName } from '@/utils/dic.js'
  124 +import { assayApplyQueryApi } from '@/api/procure-manage/assayApply.js'
  125 +
  126 +export default {
  127 + name: 'SampleSubmissionList',
  128 + components: { CardList, FilterModal },
  129 + data() {
  130 + return {
  131 + searchKeyword: '',
  132 + searchKeywordDebounced: '',
  133 + searchDebounceTimer: null,
  134 + deleted: false,
  135 + tabs: [
  136 + { label: '有效', value: false },
  137 + { label: '作废', value: true }
  138 + ],
  139 + query: {
  140 + weighingTicketCode: '',
  141 + productName: '',
  142 + planCode: '',
  143 + approvalStatus: '',
  144 + createBy: ''
  145 + },
  146 + extraParams: {},
  147 + currentItems: [],
  148 + filterVisible: false,
  149 + filterForm: {
  150 + weighingTicketCode: '',
  151 + productName: '',
  152 + planCode: '',
  153 + approvalStatus: '',
  154 + createBy: ''
  155 + },
  156 + approvalStatusOptions: [
  157 + { value: '', text: '全部' },
  158 + { value: 'DRAFT', text: '草稿' },
  159 + { value: 'AUDIT', text: '审核中' },
  160 + { value: 'PASS', text: '审核通过' },
  161 + { value: 'REFUSE', text: '已驳回' },
  162 + { value: 'CANCEL', text: '已取消' }
  163 + ],
  164 + dicOptions: {
  165 + AUDIT_STATUS: []
  166 + }
  167 + }
  168 + },
  169 + computed: {
  170 + extraCombined() {
  171 + return {
  172 + keyword: this.searchKeywordDebounced || undefined,
  173 + deleted: this.deleted
  174 + }
  175 + }
  176 + },
  177 + watch: {
  178 + extraCombined: {
  179 + deep: true,
  180 + handler(v) {
  181 + this.extraParams = v
  182 + },
  183 + immediate: true
  184 + }
  185 + },
  186 + created() {
  187 + this.loadDicData()
  188 + },
  189 + onShow() {
  190 + let needRefresh = ''
  191 + try { needRefresh = uni.getStorageSync('SAMPLE_SUBMISSION_LIST_NEED_REFRESH') } catch (e) {}
  192 + if (!needRefresh) return
  193 + try { uni.removeStorageSync('SAMPLE_SUBMISSION_LIST_NEED_REFRESH') } catch (e) {}
  194 + if (this.$refs && this.$refs.cardRef && this.$refs.cardRef.reload) {
  195 + this.$refs.cardRef.reload()
  196 + }
  197 + },
  198 + onReachBottom() {
  199 + if (this.$refs && this.$refs.cardRef && this.$refs.cardRef.onLoadMore) {
  200 + this.$refs.cardRef.onLoadMore()
  201 + }
  202 + },
  203 + beforeDestroy() {
  204 + if (this.searchDebounceTimer) {
  205 + clearTimeout(this.searchDebounceTimer)
  206 + this.searchDebounceTimer = null
  207 + }
  208 + },
  209 + methods: {
  210 + async loadDicData() {
  211 + try {
  212 + const results = await getDicByCodes(['AUDIT_STATUS'])
  213 + this.dicOptions.AUDIT_STATUS = (results.AUDIT_STATUS && results.AUDIT_STATUS.data) || []
  214 + } catch (e) {
  215 + this.dicOptions.AUDIT_STATUS = []
  216 + }
  217 + },
  218 + getAuditStatusText(status) {
  219 + const v = status == null ? '' : String(status)
  220 + if (!v) return '-'
  221 + return getDicName('AUDIT_STATUS', v, this.dicOptions.AUDIT_STATUS) || v
  222 + },
  223 + onCardLoaded({ items }) {
  224 + this.currentItems = items
  225 + },
  226 + onCardError() {
  227 + uni.showToast({ title: '列表加载失败', icon: 'none' })
  228 + },
  229 + onAdd() {
  230 + uni.navigateTo({ url: '/pages/sample-submission/add' })
  231 + },
  232 + onSearchInput() {
  233 + if (this.searchDebounceTimer) clearTimeout(this.searchDebounceTimer)
  234 + this.searchDebounceTimer = setTimeout(() => {
  235 + this.searchKeywordDebounced = this.searchKeyword
  236 + this.searchDebounceTimer = null
  237 + }, 1200)
  238 + },
  239 + search(e) {
  240 + const val = e && e.value != null ? e.value : this.searchKeyword
  241 + this.searchKeyword = val
  242 + this.searchKeywordDebounced = val
  243 + },
  244 + switchTab(t) {
  245 + this.deleted = t.value
  246 + },
  247 + openFilter() {
  248 + this.filterForm = {
  249 + weighingTicketCode: this.query.weighingTicketCode || '',
  250 + productName: this.query.productName || '',
  251 + planCode: this.query.planCode || '',
  252 + approvalStatus: this.query.approvalStatus || '',
  253 + createBy: this.query.createBy || ''
  254 + }
  255 + this.filterVisible = true
  256 + },
  257 + onFilterReset(payload) {
  258 + this.filterForm = payload
  259 + },
  260 + onFilterConfirm(payload) {
  261 + this.query = {
  262 + weighingTicketCode: payload.weighingTicketCode || '',
  263 + productName: payload.productName || '',
  264 + planCode: payload.planCode || '',
  265 + approvalStatus: payload.approvalStatus || '',
  266 + createBy: payload.createBy || ''
  267 + }
  268 + },
  269 + fetchList({ pageIndex, pageSize, query, extra }) {
  270 + const q = query || {}
  271 + const e = extra || {}
  272 + const keyword = e.keyword || ''
  273 + const params = {
  274 + pageIndex,
  275 + pageSize,
  276 + deleted: e.deleted === true,
  277 + weighingTicketCode: q.weighingTicketCode || keyword || '',
  278 + productName: q.productName || '',
  279 + planCode: q.planCode || '',
  280 + approvalStatus: q.approvalStatus || '',
  281 + createBy: q.createBy || ''
  282 + }
  283 + return assayApplyQueryApi(params)
  284 + .then(res => {
  285 + const _data = (res && res.data) || {}
  286 + let records = _data.datas || _data.list || _data.records || []
  287 + const totalCount = _data.totalCount || _data.count || 0
  288 + const hasNext = _data.hasNext || false
  289 + records = records.map(it => ({ ...it }))
  290 + return { records, totalCount, hasNext }
  291 + })
  292 + .catch(() => {
  293 + this.onCardError()
  294 + return { records: [], totalCount: 0, hasNext: false }
  295 + })
  296 + },
  297 + onCardClick(item) {
  298 + const id = item && item.id
  299 + if (!id) {
  300 + uni.showToast({ title: '缺少ID', icon: 'none' })
  301 + return
  302 + }
  303 + uni.navigateTo({ url: '/pages/sample-submission/detail?id=' + id })
  304 + }
  305 + }
  306 +}
  307 +</script>
  308 +
  309 +<style lang="scss" scoped>
  310 +.page {
  311 + display: flex;
  312 + flex-direction: column;
  313 + height: 100vh;
  314 +}
  315 +.ticket-list-fixed {
  316 + position: fixed;
  317 + top: 96rpx;
  318 + left: 0;
  319 + right: 0;
  320 + z-index: 2;
  321 + background: #fff;
  322 + .search-row {
  323 + display: flex;
  324 + align-items: center;
  325 + padding: 16rpx 32rpx;
  326 + .uni-searchbar { padding: 0; flex: 1; }
  327 + .tool-icons {
  328 + display: flex;
  329 + .tool-icon { width: 48rpx; height: 48rpx; display: block; margin-left: 32rpx; }
  330 + }
  331 + }
  332 + .tabs {
  333 + display: flex;
  334 + align-items: center;
  335 + justify-content: space-between;
  336 + padding: 26rpx 34rpx;
  337 + border-bottom: solid 1px #e7e7e7;
  338 + .tab { width: 50%; text-align: center; color: rgba(0, 0, 0, 0.9); line-height: 44rpx; position: relative; font-weight: 600; }
  339 + .tab.active { color: $theme-primary; }
  340 + .tab.active::after {
  341 + content: '';
  342 + position: absolute;
  343 + left: 50%;
  344 + transform: translateX(-50%);
  345 + bottom: -13px;
  346 + width: 32rpx;
  347 + height: 6rpx;
  348 + border-radius: 4rpx;
  349 + background: $theme-primary;
  350 + }
  351 + }
  352 +}
  353 +::v-deep .uni-searchbar__box {
  354 + height: 80rpx !important;
  355 + justify-content: start;
  356 + .uni-searchbar__box-search-input { font-size: 32rpx !important; }
  357 +}
  358 +.list-box {
  359 + flex: 1;
  360 + padding-top: 236rpx;
  361 + .card { position: relative; }
  362 + .card-header {
  363 + margin-bottom: 28rpx;
  364 + position: relative;
  365 + .title { font-size: 36rpx; font-weight: 600; line-height: 50rpx; color: rgba(0, 0, 0, 0.9); width: 578rpx; }
  366 + .status {
  367 + position: absolute;
  368 + top: -32rpx;
  369 + right: -12rpx;
  370 + height: 48rpx;
  371 + line-height: 48rpx;
  372 + font-weight: 600;
  373 + color: #fff;
  374 + font-size: 24rpx;
  375 + padding: 0 14rpx;
  376 + border-radius: 6rpx;
  377 + box-sizing: content-box;
  378 +
  379 + &.status_AUDIT { background: $theme-primary; }
  380 + &.status_PASS { background: #2ba471; }
  381 + &.status_REFUSE { background: #d54941; }
  382 + &.status_DRAFT { background: #e7e7e7; color: rgba(0, 0, 0, 0.9); }
  383 + &.status_CANCEL { background: #e7e7e7; color: rgba(0, 0, 0, 0.9); }
  384 + }
  385 + }
  386 + .info-row {
  387 + display: flex;
  388 + align-items: center;
  389 + color: rgba(0, 0, 0, 0.6);
  390 + font-size: 28rpx;
  391 + margin-bottom: 24rpx;
  392 + height: 32rpx;
  393 + &:last-child { margin-bottom: 0; }
  394 + text {
  395 + width: 50%;
  396 + &:last-child {
  397 + color: rgba(0, 0, 0, 0.9);
  398 + width: 50%;
  399 + overflow: hidden;
  400 + text-overflow: ellipsis;
  401 + white-space: nowrap;
  402 + }
  403 + }
  404 + }
  405 +}
  406 +.filter-form {
  407 + .form-item { margin-bottom: 24rpx; }
  408 + .label { margin-bottom: 20rpx; color: rgba(0, 0, 0, 0.9); height: 44rpx; line-height: 44rpx; font-size: 30rpx; }
  409 + .input {
  410 + width: 100%;
  411 + height: 72rpx;
  412 + line-height: 72rpx;
  413 + padding: 0 24rpx;
  414 + border: 1rpx solid #e7e7e7;
  415 + border-radius: 8rpx;
  416 + font-size: 28rpx;
  417 + color: rgba(0, 0, 0, 0.9);
  418 + background: #fff;
  419 + box-sizing: border-box;
  420 + }
  421 +}
  422 +</style>
  1 +<template>
  2 + <view class="page">
  3 + <scroll-view class="scroll" scroll-y>
  4 + <uni-list>
  5 + <!-- 码单编号(弹窗选择) -->
  6 + <uni-list-item class="select-item" :class="form.weighingTicketCode ? 'is-filled' : 'is-empty'" clickable
  7 + @click="openTicketSheet" :rightText="form.weighingTicketCode || '请选择码单'" showArrow>
  8 + <template v-slot:body>
  9 + <view class="item-title"><text class="required">*</text><text>码单编号</text></view>
  10 + </template>
  11 + </uni-list-item>
  12 +
  13 + <!-- 计划编号 -->
  14 + <uni-list-item class="select-item" :class="form.procurementPlanId ? 'is-filled' : 'is-empty'">
  15 + <template v-slot:body>
  16 + <view class="item-title"><text class="required">*</text><text>计划编号</text></view>
  17 + </template>
  18 + <template v-slot:footer>
  19 + <picker mode="selector" :range="planLabels" @change="onPlanChange" :disabled="!planOptions.length">
  20 + <view class="picker-value" :class="{ placeholder: !form.procurementPlanId }">
  21 + {{ getPlanLabel() || '请选择计划编号' }}
  22 + </view>
  23 + </picker>
  24 + </template>
  25 + </uni-list-item>
  26 +
  27 + <!-- 品种 -->
  28 + <uni-list-item class="select-item" :class="form.productId ? 'is-filled' : 'is-empty'">
  29 + <template v-slot:body>
  30 + <view class="item-title"><text class="required">*</text><text>品种</text></view>
  31 + </template>
  32 + <template v-slot:footer>
  33 + <picker mode="selector" :range="productLabels" @change="onProductChange" :disabled="!productOptions.length">
  34 + <view class="picker-value" :class="{ placeholder: !form.productId }">
  35 + {{ getProductLabel() || '请选择品种' }}
  36 + </view>
  37 + </picker>
  38 + </template>
  39 + </uni-list-item>
  40 +
  41 + <!-- 科室 -->
  42 + <uni-list-item class="select-item" :class="form.department ? 'is-filled' : 'is-empty'">
  43 + <template v-slot:body>
  44 + <view class="item-title"><text class="required">*</text><text>科室</text></view>
  45 + </template>
  46 + <template v-slot:footer>
  47 + <picker mode="selector" :range="departmentLabels" @change="onDepartmentChange">
  48 + <view class="picker-value" :class="{ placeholder: !form.department }">
  49 + {{ getDepartmentLabel() || '请选择科室' }}
  50 + </view>
  51 + </picker>
  52 + </template>
  53 + </uni-list-item>
  54 + </uni-list>
  55 +
  56 + <view class="footer">
  57 + <button class="btn submit" type="primary" @click="onSubmit">保存</button>
  58 + </view>
  59 + </scroll-view>
  60 +
  61 + <RelateSelectSheet :visible.sync="ticketSheet.visible" title="选择码单" :multiple="false"
  62 + :fetchFn="ticketSheet.fetchFn" :display-fields="ticketSheet.displayFields"
  63 + row-key="id" :selectedKeys.sync="ticketSheet.selectedKeys" @confirm="onTicketConfirm" />
  64 + </view>
  65 +</template>
  66 +
  67 +<script>
  68 +import RelateSelectSheet from '@/components/relate-select/index.vue'
  69 +import {
  70 + assayApplyDetailApi,
  71 + assayApplyUpdateApi,
  72 + assayApplyTicketPageApi,
  73 + assayApplyTicketDataApi,
  74 + assayApplyBreedOptionsApi
  75 +} from '@/api/procure-manage/assayApply.js'
  76 +import { getDicByCodes } from '@/utils/dic.js'
  77 +
  78 +export default {
  79 + name: 'ModifySampleSubmission',
  80 + components: { RelateSelectSheet },
  81 + data() {
  82 + return {
  83 + id: '',
  84 + form: {
  85 + weighingTicketId: '',
  86 + weighingTicketCode: '',
  87 + procurementPlanId: '',
  88 + productId: '',
  89 + department: ''
  90 + },
  91 + dicOptions: { DEPARTMENT: [] },
  92 + // 计划编号下拉选项(所选码单下的计划)
  93 + planOptions: [],
  94 + // 品种下拉选项(所选计划下的过磅品种)
  95 + productOptions: [],
  96 + ticketSheet: {
  97 + visible: false,
  98 + fetchFn: null,
  99 + displayFields: [
  100 + { label: '码单编号', field: 'code' },
  101 + { label: '分厂', field: 'workshopName' },
  102 + { label: '创建人', field: 'createBy' },
  103 + { label: '创建时间', field: 'createTime' }
  104 + ],
  105 + selectedKeys: []
  106 + }
  107 + }
  108 + },
  109 + computed: {
  110 + planLabels() {
  111 + return (this.planOptions || []).map(it => it.label)
  112 + },
  113 + productLabels() {
  114 + return (this.productOptions || []).map(it => it.label)
  115 + },
  116 + departmentLabels() {
  117 + return (this.dicOptions.DEPARTMENT || []).map(it => it.name)
  118 + }
  119 + },
  120 + created() {
  121 + this.ticketSheet.fetchFn = this.fetchTickets.bind(this)
  122 + this.loadDicData()
  123 + },
  124 + onLoad(query) {
  125 + this.id = (query && query.id) || ''
  126 + this.loadDetail()
  127 + },
  128 + methods: {
  129 + async loadDicData() {
  130 + try {
  131 + const results = await getDicByCodes(['DEPARTMENT'])
  132 + this.dicOptions.DEPARTMENT = (results.DEPARTMENT && results.DEPARTMENT.data) || []
  133 + } catch (e) {
  134 + this.dicOptions.DEPARTMENT = []
  135 + }
  136 + },
  137 + loadDetail() {
  138 + if (!this.id) {
  139 + uni.showToast({ title: '缺少单据ID', icon: 'none' })
  140 + return
  141 + }
  142 + uni.showLoading && uni.showLoading({ title: '加载中...', mask: true })
  143 + assayApplyDetailApi({ id: this.id })
  144 + .then(res => {
  145 + const data = res && res.data ? res.data : {}
  146 + this.form = {
  147 + weighingTicketId: data.weighingTicketId || '',
  148 + weighingTicketCode: data.weighingTicketCode || '',
  149 + procurementPlanId: data.procurementPlanId || '',
  150 + productId: data.productId || '',
  151 + department: data.department == null ? '' : String(data.department)
  152 + }
  153 + // 计划编号/品种下拉:先用详情数据兜底,再异步刷新真实选项
  154 + this.planOptions = this.form.procurementPlanId
  155 + ? [{ label: data.planCode || '', value: this.form.procurementPlanId }]
  156 + : []
  157 + this.productOptions = this.form.productId
  158 + ? [{ label: data.productName || '', value: this.form.productId }]
  159 + : []
  160 + if (this.form.weighingTicketId) {
  161 + this.loadPlanOptions(this.form.weighingTicketId)
  162 + }
  163 + if (this.form.weighingTicketId && this.form.procurementPlanId) {
  164 + this.loadProductOptions(this.form.weighingTicketId, this.form.procurementPlanId)
  165 + }
  166 + })
  167 + .catch(() => {
  168 + uni.showToast({ title: '详情加载失败', icon: 'none' })
  169 + })
  170 + .finally(() => {
  171 + uni.hideLoading && uni.hideLoading()
  172 + })
  173 + },
  174 + // 码单选择弹窗数据源(可选过磅码单分页)
  175 + fetchTickets({ pageIndex, pageSize, extra }) {
  176 + const keyword = (extra && extra.keyword) || ''
  177 + const params = {
  178 + pageIndex,
  179 + pageSize,
  180 + code: keyword || undefined
  181 + }
  182 + return assayApplyTicketPageApi(params).then(res => {
  183 + const _data = (res && res.data) || {}
  184 + const records = _data.datas || _data.list || _data.records || []
  185 + const totalCount = _data.totalCount || _data.count || 0
  186 + const hasNext = _data.hasNext || false
  187 + return { records, totalCount, hasNext }
  188 + }).catch(() => ({ records: [], totalCount: 0, hasNext: false }))
  189 + },
  190 + openTicketSheet() {
  191 + this.ticketSheet.selectedKeys = this.form.weighingTicketId ? [this.form.weighingTicketId] : []
  192 + this.ticketSheet.visible = true
  193 + },
  194 + // 码单选择回调:联动刷新计划编号下拉并重置品种
  195 + onTicketConfirm({ items }) {
  196 + const row = (items || [])[0]
  197 + if (!row) {
  198 + this.resetDownStream()
  199 + return
  200 + }
  201 + this.form.weighingTicketId = row.id || ''
  202 + this.form.weighingTicketCode = row.code || ''
  203 + this.resetDownStream()
  204 + this.loadPlanOptions(row.id)
  205 + },
  206 + resetDownStream() {
  207 + this.form.procurementPlanId = ''
  208 + this.form.productId = ''
  209 + this.planOptions = []
  210 + this.productOptions = []
  211 + },
  212 + // 根据所选码单加载计划编号下拉选项
  213 + loadPlanOptions(ticketId) {
  214 + assayApplyTicketDataApi(ticketId)
  215 + .then(res => {
  216 + const data = (res && res.data) || {}
  217 + const options = ((data && data.planOptions) || []).map(item => ({
  218 + label: item.planCode,
  219 + value: item.planId
  220 + }))
  221 + // 兜底:确保当前已选计划仍在选项中(回显时不丢失显示)
  222 + if (this.form.procurementPlanId &&
  223 + !options.some(item => item.value === this.form.procurementPlanId)) {
  224 + const fallback = this.planOptions.find(
  225 + item => item.value === this.form.procurementPlanId
  226 + )
  227 + if (fallback) {
  228 + options.push(fallback)
  229 + }
  230 + }
  231 + this.planOptions = options
  232 + })
  233 + .catch(() => {})
  234 + },
  235 + // 根据所选码单与计划加载品种下拉选项
  236 + loadProductOptions(ticketId, planId) {
  237 + assayApplyBreedOptionsApi({
  238 + ticketId: ticketId || undefined,
  239 + planId
  240 + })
  241 + .then(res => {
  242 + const list = (res && res.data) || []
  243 + const options = (list || []).map(item => ({
  244 + label: item.productName,
  245 + value: item.productId
  246 + }))
  247 + // 兜底:确保当前已选品种仍在选项中(回显时不丢失显示)
  248 + if (this.form.productId &&
  249 + !options.some(item => item.value === this.form.productId)) {
  250 + const fallback = this.productOptions.find(
  251 + item => item.value === this.form.productId
  252 + )
  253 + if (fallback) {
  254 + options.push(fallback)
  255 + }
  256 + }
  257 + this.productOptions = options
  258 + })
  259 + .catch(() => {})
  260 + },
  261 + getPlanLabel() {
  262 + const found = (this.planOptions || []).find(it => it.value === this.form.procurementPlanId)
  263 + return found ? found.label : ''
  264 + },
  265 + // 计划编号改选后:重置品种并按所选计划刷新过磅品种下拉
  266 + onPlanChange(e) {
  267 + const opt = (this.planOptions || [])[Number(e.detail.value)]
  268 + if (!opt) return
  269 + this.form.procurementPlanId = opt.value
  270 + this.form.productId = ''
  271 + this.productOptions = []
  272 + this.loadProductOptions(this.form.weighingTicketId, opt.value)
  273 + },
  274 + getProductLabel() {
  275 + const found = (this.productOptions || []).find(it => it.value === this.form.productId)
  276 + return found ? found.label : ''
  277 + },
  278 + onProductChange(e) {
  279 + const opt = (this.productOptions || [])[Number(e.detail.value)]
  280 + if (!opt) return
  281 + this.form.productId = opt.value
  282 + },
  283 + getDepartmentLabel() {
  284 + const found = (this.dicOptions.DEPARTMENT || []).find(it => String(it.code) === String(this.form.department))
  285 + return found ? found.name : ''
  286 + },
  287 + onDepartmentChange(e) {
  288 + const opt = (this.dicOptions.DEPARTMENT || [])[Number(e.detail.value)]
  289 + if (!opt) return
  290 + this.form.department = opt.code != null ? String(opt.code) : ''
  291 + },
  292 + validate() {
  293 + const f = this.form
  294 + if (!f.weighingTicketId) return this.tip('请选择码单编号')
  295 + if (!f.procurementPlanId) return this.tip('请选择计划编号')
  296 + if (!f.productId) return this.tip('请选择品种')
  297 + if (!f.department) return this.tip('请选择科室')
  298 + return true
  299 + },
  300 + tip(msg) {
  301 + uni.showToast({ title: msg, icon: 'none' })
  302 + return false
  303 + },
  304 + async onSubmit() {
  305 + if (!this.validate()) return
  306 + const confirmRes = await new Promise(resolve => {
  307 + uni.showModal({ title: '提示', content: '确定保存修改吗?', confirmText: '确定', cancelText: '取消', success: resolve })
  308 + })
  309 + if (!(confirmRes && confirmRes.confirm)) return
  310 + uni.showLoading({ title: '提交中...', mask: true })
  311 + assayApplyUpdateApi({
  312 + id: this.id,
  313 + weighingTicketId: this.form.weighingTicketId,
  314 + procurementPlanId: this.form.procurementPlanId,
  315 + productId: this.form.productId,
  316 + department: this.form.department
  317 + })
  318 + .then(() => {
  319 + uni.hideLoading()
  320 + uni.showToast({ title: '保存成功', icon: 'none' })
  321 + try {
  322 + uni.setStorageSync('SAMPLE_SUBMISSION_LIST_NEED_REFRESH', '1')
  323 + uni.setStorageSync('SAMPLE_SUBMISSION_DETAIL_NEED_REFRESH', '1')
  324 + } catch (e) {}
  325 + setTimeout(() => { uni.navigateBack() }, 400)
  326 + })
  327 + .catch(e => {
  328 + uni.hideLoading()
  329 + uni.showToast({ title: (e && (e.msg || e.message)) || '保存失败', icon: 'none' })
  330 + })
  331 + }
  332 + }
  333 +}
  334 +</script>
  335 +
  336 +<style lang="scss" scoped>
  337 +.page {
  338 + display: flex;
  339 + flex-direction: column;
  340 + height: 100%;
  341 +}
  342 +
  343 +.scroll {
  344 + flex: 1;
  345 + padding: 12rpx 0 200rpx !important;
  346 +}
  347 +
  348 +.footer {
  349 + z-index: 2;
  350 + position: fixed;
  351 + left: 0;
  352 + right: 0;
  353 + bottom: 0;
  354 + padding: 32rpx;
  355 + padding-bottom: calc(32rpx + env(safe-area-inset-bottom));
  356 + background: #fff;
  357 + box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06);
  358 +
  359 + .btn {
  360 + height: 80rpx;
  361 + line-height: 80rpx;
  362 + border-radius: 12rpx;
  363 + font-size: 32rpx;
  364 + }
  365 +
  366 + .submit {
  367 + background: $theme-primary;
  368 + color: #fff;
  369 + }
  370 +}
  371 +
  372 +::v-deep .uni-list {
  373 + .uni-easyinput {
  374 + display: flex;
  375 +
  376 + .uni-input-input {
  377 + color: rgba(0, 0, 0, 0.9);
  378 + }
  379 + }
  380 +
  381 + .uni-input-placeholder {
  382 + z-index: 1;
  383 + }
  384 +
  385 + .uni-input-input {
  386 + background-color: #ffffff;
  387 + }
  388 +
  389 + background: transparent;
  390 +
  391 + &-item {
  392 + &__extra-text {
  393 + font-size: 32rpx;
  394 + }
  395 +
  396 + &__content-title {
  397 + font-size: 32rpx;
  398 + color: rgba(0, 0, 0, 0.9);
  399 + }
  400 +
  401 + &__container {
  402 + padding: 32rpx;
  403 +
  404 + .item-title,
  405 + .uni-list-item__content {
  406 + flex: none;
  407 + min-height: 48rpx;
  408 + line-height: 48rpx;
  409 + font-size: 32rpx;
  410 + position: relative;
  411 + width: 240rpx;
  412 + margin-right: 32rpx;
  413 + color: rgba(0, 0, 0, 0.9);
  414 +
  415 + .required {
  416 + color: red;
  417 + position: absolute;
  418 + top: 50%;
  419 + transform: translateY(-50%);
  420 + left: -16rpx;
  421 + }
  422 + }
  423 + }
  424 +
  425 + &.select-item {
  426 + &.is-empty {
  427 + .uni-list-item__extra-text {
  428 + color: rgba(0, 0, 0, 0.4) !important;
  429 + }
  430 + }
  431 +
  432 + &.is-filled {
  433 + .uni-list-item__extra-text {
  434 + color: rgba(0, 0, 0, 0.9) !important;
  435 + }
  436 + }
  437 + }
  438 + }
  439 +}
  440 +
  441 +.picker-value {
  442 + font-size: 32rpx;
  443 + color: rgba(0, 0, 0, 0.9);
  444 + line-height: 48rpx;
  445 + text-align: right;
  446 + min-height: 48rpx;
  447 +
  448 + &.placeholder {
  449 + color: rgba(0, 0, 0, 0.4);
  450 + }
  451 +}
  452 +</style>
  1 +<template>
  2 + <view class="detail-page">
  3 + <scroll-view class="scroll" scroll-y>
  4 + <!-- 基础信息 -->
  5 + <view class="section">
  6 + <text class="row company">{{ safeText(form.weighingTicketCode) }}</text>
  7 + <view class="row"><text class="label">计划编号</text><text class="value">{{ safeText(form.planCode) }}</text></view>
  8 + <view class="row"><text class="label">品种</text><text class="value">{{ safeText(form.productName) }}</text></view>
  9 + <view class="row"><text class="label">科室</text><text class="value">{{ departmentName }}</text></view>
  10 + <view class="row"><text class="label">审核状态</text><text class="value">{{ approvalStatusName }}</text></view>
  11 + <view class="row"><text class="label">创建人</text><text class="value">{{ safeText(form.createBy) }}</text></view>
  12 + <view class="row"><text class="label">创建时间</text><text class="value">{{ safeText(form.createTime) }}</text></view>
  13 + </view>
  14 + </scroll-view>
  15 + </view>
  16 +</template>
  17 +
  18 +<script>
  19 +import { assayApplyDetailApi } from '@/api/procure-manage/assayApply.js'
  20 +import { getDicByCodes, getDicName } from '@/utils/dic.js'
  21 +
  22 +export default {
  23 + name: 'SampleSubmissionViewer',
  24 + props: { id: { type: [String, Number], default: '' } },
  25 + data() {
  26 + return {
  27 + form: {},
  28 + dicOptions: {
  29 + DEPARTMENT: [],
  30 + AUDIT_STATUS: []
  31 + }
  32 + }
  33 + },
  34 + computed: {
  35 + departmentName() {
  36 + const v = this.form.department == null ? '' : String(this.form.department)
  37 + if (!v) return '-'
  38 + return getDicName('DEPARTMENT', v, this.dicOptions.DEPARTMENT) || v
  39 + },
  40 + approvalStatusName() {
  41 + const v = this.form.approvalStatus == null ? '' : String(this.form.approvalStatus)
  42 + if (!v) return '-'
  43 + return getDicName('AUDIT_STATUS', v, this.dicOptions.AUDIT_STATUS) || v
  44 + }
  45 + },
  46 + created() {
  47 + this.loadDicData()
  48 + },
  49 + watch: {
  50 + id: {
  51 + immediate: true,
  52 + handler(val) {
  53 + const v = (val !== undefined && val !== null) ? String(val) : ''
  54 + if (v) this.loadDetail(v)
  55 + }
  56 + }
  57 + },
  58 + methods: {
  59 + async loadDicData() {
  60 + try {
  61 + const results = await getDicByCodes(['DEPARTMENT', 'AUDIT_STATUS'])
  62 + this.dicOptions.DEPARTMENT = (results.DEPARTMENT && results.DEPARTMENT.data) || []
  63 + this.dicOptions.AUDIT_STATUS = (results.AUDIT_STATUS && results.AUDIT_STATUS.data) || []
  64 + } catch (e) {
  65 + this.dicOptions = { DEPARTMENT: [], AUDIT_STATUS: [] }
  66 + }
  67 + },
  68 + loadDetail(id) {
  69 + assayApplyDetailApi({ id })
  70 + .then(res => {
  71 + const data = res && res.data ? res.data : {}
  72 + this.form = Object.assign({}, data)
  73 + })
  74 + .catch(() => {
  75 + uni.showToast({ title: '详情加载失败', icon: 'none' })
  76 + })
  77 + },
  78 + // 供审批页通过时取业务表单数据(variables,对齐 PC 端 approve.vue getFormData)
  79 + getFormValues() {
  80 + return Object.assign({}, this.form)
  81 + },
  82 + // 审批表单只读,无需校验
  83 + checkForm() {
  84 + return true
  85 + },
  86 + safeText(v) {
  87 + const s = v == null ? '' : String(v)
  88 + return s.trim() ? s : '-'
  89 + }
  90 + }
  91 +}
  92 +</script>
  93 +
  94 +<style lang="scss" scoped>
  95 +.detail-page {
  96 + background: #f3f3f3;
  97 + min-height: 100%;
  98 +}
  99 +.scroll {
  100 + height: 100%;
  101 +}
  102 +.section {
  103 + padding: 32rpx;
  104 + background: #fff;
  105 + margin-bottom: 20rpx;
  106 +}
  107 +.row {
  108 + display: flex;
  109 + margin-bottom: 28rpx;
  110 +
  111 + &:last-child {
  112 + margin-bottom: 0;
  113 + }
  114 +
  115 + &.company {
  116 + font-size: 36rpx;
  117 + font-weight: 600;
  118 + color: rgba(0, 0, 0, 0.9);
  119 + padding-top: 8rpx;
  120 + line-height: 50rpx;
  121 + }
  122 +
  123 + .label {
  124 + max-width: 420rpx;
  125 + margin-right: 20rpx;
  126 + line-height: 32rpx;
  127 + font-size: 28rpx;
  128 + color: rgba(0, 0, 0, 0.6);
  129 + }
  130 +
  131 + .value {
  132 + flex: 1;
  133 + line-height: 32rpx;
  134 + font-size: 28rpx;
  135 + color: rgba(0, 0, 0, 0.9);
  136 + text-align: right;
  137 + word-break: break-all;
  138 + }
  139 +}
  140 +</style>
@@ -186,6 +186,8 @@ export default { @@ -186,6 +186,8 @@ export default {
186 const isAudit = status === 'AUDIT' 186 const isAudit = status === 'AUDIT'
187 const showExamine = this.form.showExamine === true 187 const showExamine = this.form.showExamine === true
188 const showExamineDetail = this.form.showExamineDetail === true 188 const showExamineDetail = this.form.showExamineDetail === true
  189 +
  190 + const isReweigh = String(this.form.code || '').charAt(0) === 'F'
189 return [ 191 return [
190 { 192 {
191 ...this.buttons[0], 193 ...this.buttons[0],
@@ -201,7 +203,7 @@ export default { @@ -201,7 +203,7 @@ export default {
201 }, 203 },
202 { 204 {
203 ...this.buttons[3], 205 ...this.buttons[3],
204 - visible: (isAudit || isPass) && showExamineDetail && this.$auth.hasPermi('warehouse-manage:weight-ticket:review') 206 + visible: showExamineDetail && this.$auth.hasPermi('warehouse-manage:weight-ticket:review')
205 }, 207 },
206 { 208 {
207 ...this.buttons[4], 209 ...this.buttons[4],
@@ -217,7 +219,7 @@ export default { @@ -217,7 +219,7 @@ export default {
217 }, 219 },
218 { 220 {
219 ...this.buttons[7], 221 ...this.buttons[7],
220 - visible: isPass && this.$auth.hasPermi('warehouse-manage:weight-ticket:reweigh') 222 + visible: isPass && !isReweigh && this.$auth.hasPermi('warehouse-manage:weight-ticket:reweigh')
221 } 223 }
222 ] 224 ]
223 } 225 }
@@ -12,23 +12,24 @@ @@ -12,23 +12,24 @@
12 </template> 12 </template>
13 </uni-list-item> 13 </uni-list-item>
14 14
15 - <!-- 类型 --> 15 + <!-- 类型(复磅单只读) -->
16 <uni-list-item class="select-item" :class="form.type ? 'is-filled' : 'is-empty'"> 16 <uni-list-item class="select-item" :class="form.type ? 'is-filled' : 'is-empty'">
17 <template v-slot:body> 17 <template v-slot:body>
18 <view class="item-title"><text class="required">*</text><text>类型</text></view> 18 <view class="item-title"><text class="required">*</text><text>类型</text></view>
19 </template> 19 </template>
20 <template v-slot:footer> 20 <template v-slot:footer>
21 - <picker mode="selector" :range="typeLabels" @change="onTypeChange"> 21 + <picker v-if="!isReweigh" mode="selector" :range="typeLabels" @change="onTypeChange">
22 <view class="picker-value" :class="{ placeholder: !form.type }"> 22 <view class="picker-value" :class="{ placeholder: !form.type }">
23 {{ getTypeLabel() || '请选择类型' }} 23 {{ getTypeLabel() || '请选择类型' }}
24 </view> 24 </view>
25 </picker> 25 </picker>
  26 + <uni-easyinput v-else :value="getTypeLabel() || form.type" :inputBorder="false" disabled />
26 </template> 27 </template>
27 </uni-list-item> 28 </uni-list-item>
28 29
29 - <!-- 计划编号(弹窗多选计划) -->  
30 - <uni-list-item class="select-item" :class="form.planCode ? 'is-filled' : 'is-empty'" clickable  
31 - @click="openPlanSheet" :rightText="form.planCode || '请选择计划'" showArrow> 30 + <!-- 计划编号(弹窗多选计划;复磅单只读) -->
  31 + <uni-list-item class="select-item" :class="form.planCode ? 'is-filled' : 'is-empty'" :clickable="!isReweigh"
  32 + @click="!isReweigh && openPlanSheet()" :rightText="form.planCode || '请选择计划'" :showArrow="!isReweigh">
32 <template v-slot:body> 33 <template v-slot:body>
33 <view class="item-title"><text class="required">*</text><text>计划编号</text></view> 34 <view class="item-title"><text class="required">*</text><text>计划编号</text></view>
34 </template> 35 </template>
@@ -86,12 +87,12 @@ @@ -86,12 +87,12 @@
86 </view> 87 </view>
87 </view> 88 </view>
88 89
89 - <!-- 过磅明细(可编辑) --> 90 + <!-- 过磅明细(可编辑;复磅单仅过磅数量可编辑) -->
90 <view class="sub-table"> 91 <view class="sub-table">
91 <view class="header"> 92 <view class="header">
92 <image class="opCollapse" src="/static/images/title.png" /> 93 <image class="opCollapse" src="/static/images/title.png" />
93 <text class="title">过磅明细</text> 94 <text class="title">过磅明细</text>
94 - <view class="ops"> 95 + <view v-if="!isReweigh" class="ops">
95 <image class="opAdd" @click="addWeightRow" src="/static/images/plus.png" /> 96 <image class="opAdd" @click="addWeightRow" src="/static/images/plus.png" />
96 </view> 97 </view>
97 </view> 98 </view>
@@ -104,12 +105,13 @@ @@ -104,12 +105,13 @@
104 <view class="item-title"><text class="required">*</text><text>计划编号</text></view> 105 <view class="item-title"><text class="required">*</text><text>计划编号</text></view>
105 </template> 106 </template>
106 <template v-slot:footer> 107 <template v-slot:footer>
107 - <picker mode="selector" :range="planCodeLabels" 108 + <picker v-if="!isReweigh" mode="selector" :range="planCodeLabels"
108 @change="(e) => handleWeighPlanChange(idx, Number(e.detail.value))"> 109 @change="(e) => handleWeighPlanChange(idx, Number(e.detail.value))">
109 <view class="picker-value" :class="{ placeholder: !item.planCode }"> 110 <view class="picker-value" :class="{ placeholder: !item.planCode }">
110 {{ item.planCode || '请选择计划编号' }} 111 {{ item.planCode || '请选择计划编号' }}
111 </view> 112 </view>
112 </picker> 113 </picker>
  114 + <uni-easyinput v-else :value="item.planCode" :inputBorder="false" disabled />
113 </template> 115 </template>
114 </uni-list-item> 116 </uni-list-item>
115 <uni-list-item class="select-item" :class="item.productId ? 'is-filled' : 'is-empty'"> 117 <uni-list-item class="select-item" :class="item.productId ? 'is-filled' : 'is-empty'">
@@ -117,12 +119,13 @@ @@ -117,12 +119,13 @@
117 <view class="item-title"><text class="required">*</text><text>过磅品种</text></view> 119 <view class="item-title"><text class="required">*</text><text>过磅品种</text></view>
118 </template> 120 </template>
119 <template v-slot:footer> 121 <template v-slot:footer>
120 - <picker mode="selector" :range="getWeightProductLabels(item)" 122 + <picker v-if="!isReweigh" mode="selector" :range="getWeightProductLabels(item)"
121 @change="(e) => handleWeightProductChange(idx, Number(e.detail.value))"> 123 @change="(e) => handleWeightProductChange(idx, Number(e.detail.value))">
122 <view class="picker-value" :class="{ placeholder: !item.productId }"> 124 <view class="picker-value" :class="{ placeholder: !item.productId }">
123 {{ getWeightProductLabel(item) || '请选择过磅品种' }} 125 {{ getWeightProductLabel(item) || '请选择过磅品种' }}
124 </view> 126 </view>
125 </picker> 127 </picker>
  128 + <uni-easyinput v-else :value="getWeightProductLabel(item) || item.productName" :inputBorder="false" disabled />
126 </template> 129 </template>
127 </uni-list-item> 130 </uni-list-item>
128 <uni-list-item title="开票品名"> 131 <uni-list-item title="开票品名">
@@ -139,7 +142,7 @@ @@ -139,7 +142,7 @@
139 </template> 142 </template>
140 </uni-list-item> 143 </uni-list-item>
141 </uni-list> 144 </uni-list>
142 - <view class="block-ops"> 145 + <view v-if="!isReweigh" class="block-ops">
143 <div class="del" @click="removeRow('weigh', idx)"> 146 <div class="del" @click="removeRow('weigh', idx)">
144 <image src="/static/images/delete.png" class="icon" />删除 147 <image src="/static/images/delete.png" class="icon" />删除
145 </div> 148 </div>
@@ -148,12 +151,12 @@ @@ -148,12 +151,12 @@
148 </view> 151 </view>
149 </view> 152 </view>
150 153
151 - <!-- 申请数量明细(仅买断展示) --> 154 + <!-- 申请数量明细(仅买断展示;复磅单只读) -->
152 <view v-if="isBuyout" class="sub-table"> 155 <view v-if="isBuyout" class="sub-table">
153 <view class="header"> 156 <view class="header">
154 <image class="opCollapse" src="/static/images/title.png" /> 157 <image class="opCollapse" src="/static/images/title.png" />
155 <text class="title">申请数量明细</text> 158 <text class="title">申请数量明细</text>
156 - <view class="ops"> 159 + <view v-if="!isReweigh" class="ops">
157 <image class="opAdd" @click="addApplyRow" src="/static/images/plus.png" /> 160 <image class="opAdd" @click="addApplyRow" src="/static/images/plus.png" />
158 </view> 161 </view>
159 </view> 162 </view>
@@ -166,12 +169,13 @@ @@ -166,12 +169,13 @@
166 <view class="item-title"><text class="required">*</text><text>类别</text></view> 169 <view class="item-title"><text class="required">*</text><text>类别</text></view>
167 </template> 170 </template>
168 <template v-slot:footer> 171 <template v-slot:footer>
169 - <picker mode="selector" :range="varietyLabels" 172 + <picker v-if="!isReweigh" mode="selector" :range="varietyLabels"
170 @change="(e) => handleVarietyChange(idx, Number(e.detail.value))"> 173 @change="(e) => handleVarietyChange(idx, Number(e.detail.value))">
171 <view class="picker-value" :class="{ placeholder: !item.breedRelationshipId }"> 174 <view class="picker-value" :class="{ placeholder: !item.breedRelationshipId }">
172 {{ getVarietyLabel(item) || '请选择类别' }} 175 {{ getVarietyLabel(item) || '请选择类别' }}
173 </view> 176 </view>
174 </picker> 177 </picker>
  178 + <uni-easyinput v-else :value="getVarietyLabel(item) || item.category" :inputBorder="false" disabled />
175 </template> 179 </template>
176 </uni-list-item> 180 </uni-list-item>
177 <uni-list-item title="数量"> 181 <uni-list-item title="数量">
@@ -179,11 +183,11 @@ @@ -179,11 +183,11 @@
179 <view class="item-title"><text class="required">*</text><text>数量</text></view> 183 <view class="item-title"><text class="required">*</text><text>数量</text></view>
180 </template> 184 </template>
181 <template v-slot:footer> 185 <template v-slot:footer>
182 - <uni-easyinput v-model="item.quantity" type="digit" :inputBorder="false" placeholder="请输入数量" /> 186 + <uni-easyinput v-model="item.quantity" type="digit" :inputBorder="false" placeholder="请输入数量" :disabled="isReweigh" />
183 </template> 187 </template>
184 </uni-list-item> 188 </uni-list-item>
185 </uni-list> 189 </uni-list>
186 - <view class="block-ops"> 190 + <view v-if="!isReweigh" class="block-ops">
187 <div class="del" @click="removeRow('apply', idx)"> 191 <div class="del" @click="removeRow('apply', idx)">
188 <image src="/static/images/delete.png" class="icon" />删除 192 <image src="/static/images/delete.png" class="icon" />删除
189 </div> 193 </div>
@@ -365,6 +369,10 @@ export default { @@ -365,6 +369,10 @@ export default {
365 } 369 }
366 }, 370 },
367 computed: { 371 computed: {
  372 + // 编号以F开头 = 复磅生成的单据,可编辑字段与复磅一致
  373 + isReweigh() {
  374 + return String(this.form.code || '').charAt(0) === 'F'
  375 + },
368 typeLabels() { 376 typeLabels() {
369 return (this.dicOptions.TYPE || []).map(it => it.name) 377 return (this.dicOptions.TYPE || []).map(it => it.name)
370 }, 378 },
@@ -30,6 +30,7 @@ import DomesticPlanViewer from '@/pages/domestic-plan/domesticPlanViewer.vue' @@ -30,6 +30,7 @@ import DomesticPlanViewer from '@/pages/domestic-plan/domesticPlanViewer.vue'
30 import SupplePlanViewer from '@/pages/supple-plan/supplePlanViewer.vue' 30 import SupplePlanViewer from '@/pages/supple-plan/supplePlanViewer.vue'
31 import DomesticAgreementViewer from '@/pages/domestic-agreement/domesticAgreementViewer.vue' 31 import DomesticAgreementViewer from '@/pages/domestic-agreement/domesticAgreementViewer.vue'
32 import WeightTicketViewer from '@/pages/weight-ticket/weightTicketViewer.vue' 32 import WeightTicketViewer from '@/pages/weight-ticket/weightTicketViewer.vue'
  33 +import SampleSubmissionViewer from '@/pages/sample-submission/sampleSubmissionViewer.vue'
33 34
34 export default function registerComponents(Vue) { 35 export default function registerComponents(Vue) {
35 Vue.component('CustomerDevelopViewer', CustomerDevelopViewer) 36 Vue.component('CustomerDevelopViewer', CustomerDevelopViewer)
@@ -64,4 +65,5 @@ export default function registerComponents(Vue) { @@ -64,4 +65,5 @@ export default function registerComponents(Vue) {
64 Vue.component('SupplePlanViewer', SupplePlanViewer) 65 Vue.component('SupplePlanViewer', SupplePlanViewer)
65 Vue.component('DomesticAgreementViewer', DomesticAgreementViewer) 66 Vue.component('DomesticAgreementViewer', DomesticAgreementViewer)
66 Vue.component('WeightTicketViewer', WeightTicketViewer) 67 Vue.component('WeightTicketViewer', WeightTicketViewer)
  68 + Vue.component('SampleSubmissionViewer', SampleSubmissionViewer)
67 } 69 }
@@ -159,6 +159,12 @@ export const getSysFlowComponentPath = (bizFlag) => { @@ -159,6 +159,12 @@ export const getSysFlowComponentPath = (bizFlag) => {
159 case 'WEIGHING_RECORD_EDIT': // 过磅码单 159 case 'WEIGHING_RECORD_EDIT': // 过磅码单
160 componentPath = 'WeightTicketViewer'; // 过磅码单-审批 160 componentPath = 'WeightTicketViewer'; // 过磅码单-审批
161 break; 161 break;
  162 + case 'ASSAY_APPLY': // 化验送样单
  163 + componentPath = 'SampleSubmissionViewer'; // 化验送样单-审批详情
  164 + break;
  165 + case 'ASSAY_APPLY_EDIT': // 化验送样单
  166 + componentPath = 'SampleSubmissionViewer'; // 化验送样单-审批
  167 + break;
162 } 168 }
163 return componentPath; 169 return componentPath;
164 }; 170 };