| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287 |
- <template>
- <view class="">
- <u-sticky offset-top="50">
- <u-subsection fontSize='25' mode='subsection' :list="list" :current="curNow" @change="sectionChange"
- activeColor='#157A2C'></u-subsection>
- </u-sticky>
- <view v-show='curNow==0'>
- <u--form style="margin: 0 20px;" labelPosition="left" :model="form" ref="uForm" labelWidth='140rpx'>
- <!-- @tap="showDeptPicker" -->
- <u-form-item label="需求类型" prop="sourceTypeName" borderBottom>
- <u--input style="width: 100%;" disabled v-model="form.sourceTypeName"></u--input>
- </u-form-item>
- <!-- @tap="showUserPicker" -->
- <u-form-item label="需求单名称" prop="requirementName" borderBottom>
- <u--input style="width: 100%;" disabled v-model="form.requirementName"></u--input>
- <!-- <u-icon slot="right" name="arrow-right"></u-icon> -->
- </u-form-item>
- <u-form-item label="需求部门" prop="requireDeptName" borderBottom>
- <u--input style="width: 100%;" disabled v-model="form.requireDeptName"></u--input>
- </u-form-item>
- <u-form-item label="需求人" prop="requireUserName" borderBottom>
- <u--input style="width: 100%;" disabled v-model="form.requireUserName"></u--input>
- </u-form-item>
- <u-form-item v-if='form.sourceType==1' label="销售合同" prop="saleContractName" borderBottom>
- <u--input style="width: 100%;" disabled v-model="form.saleContractName"></u--input>
- </u-form-item>
- <u-form-item v-if='form.sourceType==1' label="销售订单" prop="saleOrderNo" borderBottom>
- <u--input style="width: 100%;" disabled v-model="form.saleOrderNo"></u--input>
- </u-form-item>
- <u-form-item label="是否接受拆单" prop="acceptUnpack" borderBottom>
- <u-tag v-if='form.acceptUnpack==1' text="接受" size="large" type="success"></u-tag>
- <u-tag v-else-if='form.acceptUnpack==0' text="不接受" size="large" type="warning"></u-tag>
- <u--input v-else style="width: 100%;" disabled v-model="form.acceptUnpack"></u--input>
- </u-form-item>
- <u-form-item label="用途" prop="useTo" borderBottom>
- <u--input style="width: 100%;" disabled v-model="form.useTo"></u--input>
- </u-form-item>
- <u-form-item label="附件" prop="fileId" borderBottom>
- <fileMain type="view" v-model="form.fileId"></fileMain>
- </u-form-item>
- <u-form-item label="备注" prop="remark" borderBottom>
- <u--input style="width: 100%;" disabled v-model="form.remark"></u--input>
- </u-form-item>
- </u--form>
- </view>
- <view v-show='curNow==1'>
- <view v-for="(item,index) in form['detailList']" :key="index">
- <u--form style="margin: 0 20px;" labelPosition="left" :model="form" ref="uForm" labelWidth='140rpx'>
- <u-row v-for="(key,index1) in tableField" :key="index1">
- <u-col :span="12">
- <u-form-item :label="key.label" prop="categoryName" borderBottom>
- <view v-if="key.field == 'expectReceiveDate'">
- <view v-if="item.arrivalWay == 2" style="color: #42b983;" @click="settingDate(item, index)">
- 分批时间
- </view>
- <u--input v-else style="width: 100%;" :title='item[key.field]' disabled
- v-model="item[key.field]"></u--input>
- </view>
- <view v-else-if="key.field == 'technicalDrawings' || key.field == 'files'">
- <fileMain type="view" v-model="item[key.field]"></fileMain>
- </view>
- <u--input v-else style="width: 100%;" :title='item[key.field]' disabled
- v-model="item[key.field]"></u--input>
- </u-form-item>
- </u-col>
- </u-row>
- </u--form>
- <u-gap height="40" bgColor="#f0f0f0"></u-gap>
- </view>
- </view>
- <timePopup ref="timePopupRef" :isView="true"></timePopup>
- </view>
- </template>
- <script>
- import {
- getPurchaseRequirementByIdsAPI
- } from '@/api/wt/index.js'
- import fileMain from "@/pages/doc/index.vue"
- import { levelList, lbjtList } from '@/enum/dict'
- import { getByCode } from '@/api/pda/common.js'
- import timePopup from '@/pages/purchasingManage/components/timePopup.vue'
- export default {
- props: {
- businessId: {
- default: ''
- },
- taskDefinitionKey: {
- default: ''
- },
- },
- components: {
- fileMain,
- timePopup
- },
- data() {
- return {
- detailData: {},
- form: {},
- tableField: [{
- label: '名称',
- field: 'productName',
- },
- {
- label: '编码',
- field: 'productCode',
- },
- {
- label: '分类',
- field: 'productCategoryName',
- },
- {
- label: '数量',
- field: 'purchaseCountName',
- },
- // {
- // label: '单位',
- // field: 'purchaseUnit',
- // },
- {
- label: '计量数量',
- field: 'totalCountName',
- },
- // {
- // label: '计量单位',
- // field: 'measuringUnit',
- // },
- {
- label: '包装规格',
- field: 'packingSpecification',
- },
- {
- label: '物品级别',
- field: 'goodsLevelName',
- },
- {
- label: '库存数量',
- field: 'availableCountBase',
- },
- {
- label: '已采数量',
- field: 'doneTotalCount', // measuringUnit
- },
- {
- label: '待采数量',
- field: 'waitTotalCount', // measuringUnit
- },
- {
- label: '工序',
- field: 'taskName',
- },
- {
- label: '批次号',
- field: 'batchNo',
- },
- {
- label: '供应商',
- field: 'supplierName',
- },
- {
- label: '产地',
- field: 'provenanceName',
- },
- {
- label: '型号',
- field: 'modelType',
- },
- {
- label: '规格',
- field: 'specification',
- },
- {
- label: '品牌',
- field: 'brand',
- },
- {
- label: '机型',
- field: 'modelKey',
- },
- {
- label: '颜色',
- field: 'colorKey',
- },
- {
- label: '到货方式',
- field: 'arrivalWayName',
- },
- {
- label: '到货日期',
- field: 'expectReceiveDate',
- },
- {
- label: '属性类型',
- field: 'produceTypeName',
- },
- {
- label: '图纸附件',
- field: 'technicalDrawings',
- },
- {
- label: '附件',
- field: 'files',
- },
- {
- label: '备注',
- field: 'remark',
- },
- ],
- list: ['基本信息', '需求清单'],
- curNow: 0,
- arrivalWayList: [
- { text: '一次性到货', value: 1 },
- { text: '分批到货', value: 2 }
- ],
- purchase_origin: [],
- current: {},
- currentIndex: -1,
- }
- },
- async mounted() {
- this.getByCode()
- await this.getDetailData(this.businessId);
- },
- methods: {
- sectionChange(index) {
- this.curNow = index;
- },
- settingDate(item, index) {
- console.log(item, index)
- this.current = item;
- this.currentIndex = index;
- this.$refs.timePopupRef.open(item, index)
- },
- async getDetailData(id) {
- const data = await getPurchaseRequirementByIdsAPI(id);
- this.form = data
- this.form.fileId = this.form.fileId ? JSON.parse(this.form.fileId) : [];
- this.form.detailList.forEach(item => {
- item.purchaseCountName = (item.purchaseCount ? item.purchaseCount : '') + item.purchaseUnit;
- item.totalCountName = (item.totalCount ? item.totalCount : '') + item.measuringUnit;
- item.goodsLevelName = levelList.find(i => i.value == item.goodsLevel)?.text || '';
- item.doneTotalCount = (item.doneTotalCount ? item.doneTotalCount : '') + item.measuringUnit;
- item.waitTotalCount = (item.waitTotalCount ? item.waitTotalCount : '') + item.measuringUnit;
- item.arrivalWayName = this.arrivalWayList.find(i => i.value == item.arrivalWay)?.text || '';
- item.produceTypeName = item.produceType ? item.produceType.map(i => lbjtList[i]).join(',') : '';
- item.provenanceName = this.getProvenance(item.provenance);
- })
- console.log('form~~~', this.form)
- },
- getProvenance(item) {
- if (!item) {
- return '';
- }
- let arr = item;
- if(!Array.isArray(arr)) {
- console.log('arr is not array, convert to array')
- arr = arr.split(',');
- }
- return arr && arr.length ? arr.map((i) => {
- return this.purchase_origin.find(p => p.value == i)?.text
- }).join(',') : '';
- },
- getByCode() {
- const codeS = ['purchase_origin']
- codeS.forEach(async (code) => {
- const codeValue = await getByCode(code);
- this[code] = codeValue.map(item => {
- const key = Object.keys(item)[0]
- return {
- value: key,
- text: item[key]
- }
- })
- console.log(code, this[code])
- })
- },
- }
- }
- </script>
- <style>
- </style>
|