123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506 |
- <template>
- <div class="tenant">
- <div class="content">
- <byTable
- :source="sourceList.data"
- :pagination="sourceList.pagination"
- :config="config"
- :loading="loading"
- highlight-current-row
- :selectConfig="selectConfig"
- :table-events="{
- //element talbe事件都能传
- }"
- :action-list="[]"
- @get-list="getList"
- @moreSearch="() => (dialogVisibleThree = true)"
- >
- <template #contractCode="{ item }">
- <div
- style="cursor: pointer; color: #409eff"
- @click="handleClickContractCode(item)"
- >
- {{ item.contractCode }}
- </div>
- </template>
- <template #arrivalStatus="{ item }">
- <span
- style="cursor: pointer; color: #409eff"
- @click="handleClickArrivalStatus(item)"
- >
- {{ dictValueLabel(item.arrivalStatus, arrivalStatus) }}
- </span>
- <span v-if="item.isTransit == 1">(有在途)</span>
- </template>
- <template #btn="{ item }">
- <div>
- <el-button
- type="primary"
- v-if="item.purchaseStatus == 30"
- link
- @click="handleReturnGoods(item)"
- >退货</el-button
- >
- <el-button
- type="primary"
- link
- v-if="item.purchaseStatus == 30 && item.purchaseStatus != 99"
- @click="handleArrival(item, 'add')"
- >发货登记</el-button
- >
- <el-button
- type="primary"
- link
- v-if="item.purchaseStatus == 30 && item.purchaseStatus != 99"
- @click="handleArrival(item, 'edit')"
- >到货通知</el-button
- >
- <el-button
- type="primary"
- link
- v-if="
- item.purchaseStatus == 10 ||
- (item.purchaseStatus == 30 && item.arrivalStatus == 0)
- "
- @click="handleEdit(item, 88)"
- >作废</el-button
- >
- <el-button
- type="primary"
- link
- v-if="item.purchaseStatus == 30"
- @click="handleEdit(item, 99)"
- >结束</el-button
- >
- </div>
- </template>
- </byTable>
- </div>
- <el-dialog
- :title="modalType === 'add' ? '发货登记' : '到货通知'"
- v-model="dialogVisible"
- width="80%"
- destroy-on-close
- >
- <byForm
- :formConfig="formConfig"
- :formOption="formOption"
- v-model="formData.data"
- :rules="rules"
- ref="byform"
- v-loading="submitLoading"
- >
- <template #detailSlot>
- <div style="width: 100%">
- <el-table
- :data="
- modalType === 'add'
- ? formData.data.deliverGoodsDetailsList
- : formData.data.arrivalDetailList
- "
- >
- <el-table-column
- prop="productDefinition"
- label="物品类型"
- :formatter="
- (row) =>
- row.productDefinition == 1
- ? '产品'
- : row.productDefinition == 2
- ? '物料'
- : ''
- "
- />
- <el-table-column prop="productCode" label="物品编码" />
- <el-table-column prop="productName" label="物品名称" />
- <el-table-column prop="productSpec" label="规格型号" />
- <el-table-column
- prop="productUnit"
- label="单位"
- :formatter="
- (row) => dictValueLabel(row.productUnit, productUnit)
- "
- />
- <el-table-column prop="count" label="采购数量" />
- <el-table-column
- prop="alreadyDeliverGoodsQuantity"
- label="累计发货"
- v-if="modalType === 'add'"
- />
- <el-table-column
- prop="deliverGoodsQuantity"
- label="本次发货"
- min-width="150"
- v-if="modalType === 'add'"
- >
- <template #default="{ row, $index }">
- <el-form-item
- :prop="
- 'deliverGoodsDetailsList.' +
- $index +
- '.deliverGoodsQuantity'
- "
- :rules="rules.deliverGoodsQuantity"
- :inline-message="true"
- >
- <el-input-number
- v-model="row.deliverGoodsQuantity"
- :precision="2"
- :controls="false"
- :min="0"
- onmousewheel="return false;"
- />
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column
- prop="transitQuantity"
- label="剩余在途"
- v-if="modalType === 'edit'"
- />
- <el-table-column
- prop="deliverGoodsQuantity"
- label="本次到货"
- min-width="150"
- v-if="modalType === 'edit'"
- >
- <template #default="{ row, $index }">
- <el-form-item
- :prop="
- 'arrivalDetailList.' + $index + '.deliverGoodsQuantity'
- "
- :rules="rules.deliverGoodsQuantity"
- :inline-message="true"
- >
- <el-input-number
- v-model="row.deliverGoodsQuantity"
- :precision="2"
- :controls="false"
- :min="0"
- onmousewheel="return false;"
- />
- </el-form-item>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </template>
- </byForm>
- <template #footer>
- <el-button @click="dialogVisible = false" size="large">取 消</el-button>
- <el-button
- type="primary"
- @click="submitForm()"
- size="large"
- :loading="submitLoading"
- >
- 确 定
- </el-button>
- </template>
- </el-dialog>
- <el-dialog
- :title="'到货详情'"
- v-model="dialogVisibleOne"
- width="80%"
- destroy-on-close
- >
- <byForm
- :formConfig="formConfigOne"
- :formOption="formOption"
- v-model="formData.dataOne"
- :rules="rules"
- ref="byformOne"
- >
- <template #detailSlot>
- <div style="width: 100%">
- <el-table :data="formData.dataOne.purchaseDetailVoList">
- <el-table-column prop="productCustomCode" label="物品编码" />
- <el-table-column prop="productName" label="物品名称" />
- <el-table-column prop="count" label="采购数量" />
- <el-table-column prop="deliverGoodsQuantity" label="已发货">
- <template #default="{ row }">
- <div>
- <el-popover
- placement="bottom-start"
- title="发货详情"
- :width="500"
- trigger="hover"
- >
- <div default>
- <el-table :data="row.deliverGoodsDetailList">
- <el-table-column
- label="发货时间"
- prop="createTime"
- width="155"
- />
- <el-table-column
- label="物流单号"
- prop="logisticsCode"
- />
- <el-table-column
- label="数量"
- prop="deliverGoodsQuantity"
- width="100"
- />
- </el-table>
- </div>
- <template #reference>
- <div style="cursor: pointer; color: #0084ff">
- {{ row.deliverGoodsQuantity }}
- </div>
- </template>
- </el-popover>
- </div>
- </template>
- </el-table-column>
- <!-- <el-table-column prop="arrivalQuantity" label="已到货">
- <template #default="{ row }">
- <div>
- <el-popover
- placement="bottom-start"
- title="到货详情"
- :width="500"
- trigger="hover"
- >
- <div default>
- <el-table :data="row.arrivalDetailList">
- <el-table-column
- label="到货时间"
- prop="createTime"
- width="155"
- />
- <el-table-column
- label="物流单号"
- prop="logisticsCode"
- />
- <el-table-column
- label="数量"
- prop="count"
- width="100"
- />
- </el-table>
- </div>
- <template #reference>
- <div style="cursor: pointer; color: #0084ff">
- {{ row.arrivalQuantity }}
- </div>
- </template>
- </el-popover>
- </div>
- </template>
- </el-table-column> -->
- <el-table-column prop="receiptQuantity" label="已入库">
- <template #default="{ row }">
- <div>
- <el-popover
- placement="bottom-start"
- title="入库详情"
- :width="500"
- trigger="hover"
- >
- <div default>
- <el-table :data="row.receiptList">
- <el-table-column
- label="入库时间"
- prop="createTime"
- width="155"
- />
- <el-table-column
- label="入库单号"
- prop="logisticsCode"
- />
- <el-table-column
- label="数量"
- prop="quantity"
- width="100"
- />
- </el-table>
- </div>
- <template #reference>
- <div style="cursor: pointer; color: #0084ff">
- {{ row.receiptQuantity }}
- </div>
- </template>
- </el-popover>
- </div>
- </template>
- </el-table-column>
- <el-table-column prop="purchaseBackQuantity" label="退货">
- <template #default="{ row }">
- <div>
- <el-popover
- placement="bottom-start"
- title="退货详情"
- :width="500"
- trigger="hover"
- >
- <div default>
- <el-table :data="row.purchaseBackDetailsList">
- <el-table-column label="申请时间" prop="createTime" />
- <el-table-column label="申请数量" prop="quantity" />
- <el-table-column
- label="已退数量"
- prop="returnedQuantity"
- />
- </el-table>
- </div>
- <template #reference>
- <div style="cursor: pointer; color: #0084ff">
- {{ row.purchaseBackQuantity }}
- </div>
- </template>
- </el-popover>
- </div>
- </template>
- </el-table-column>
- <el-table-column prop="qualityQuantity" label="已质检数量" />
- <el-table-column prop="noQualifiedCount" label="不合格数量" />
- </el-table>
- </div>
- </template>
- </byForm>
- <template #footer>
- <el-button @click="dialogVisibleOne = false" size="large"
- >取 消</el-button
- >
- </template>
- </el-dialog>
- <el-dialog
- :title="'采购退货'"
- v-model="dialogVisibleTwo"
- width="60%"
- destroy-on-close
- >
- <byForm
- :formConfig="formConfigTwo"
- :formOption="formOption"
- v-model="formData.dataTwo"
- :rules="rulesTwo"
- ref="byformTwo"
- v-loading="loadingTwo"
- >
- <template #detailSlot>
- <div style="width: 100%">
- <el-table :data="formData.dataTwo.purchaseBackDetailsList">
- <el-table-column
- prop="subscribeCode"
- label="申购单号"
- width="110"
- />
- <el-table-column
- prop="planArrivalTime"
- label="要求到货时间"
- width="160"
- />
- <el-table-column
- prop="productCustomCode"
- label="物品编码"
- width="110"
- />
- <el-table-column
- prop="productName"
- label="物品名称"
- width="160"
- />
- <el-table-column
- prop="productUnit"
- label="物品单位"
- width="80"
- :formatter="
- (row) => dictValueLabel(row.productUnit, productUnit)
- "
- />
- <el-table-column
- prop="price"
- label="单价"
- width="60"
- :formatter="
- (row) => dictValueLabel(row.productUnit, productUnit)
- "
- />
- <el-table-column prop="count" label="采购数量" width="100" />
- <el-table-column
- prop="defectiveQuantity"
- label="次品数量"
- width="100"
- />
- <el-table-column
- prop="quantity"
- label="退货数量"
- min-width="150"
- fixed="right"
- >
- <template #default="{ row, $index }">
- <el-form-item
- :prop="'purchaseBackDetailsList.' + $index + '.quantity'"
- :rules="rulesTwo.quantity"
- :inline-message="true"
- >
- <el-input-number
- v-model="row.quantity"
- :precision="0"
- :controls="false"
- :min="0"
- onmousewheel="return false;"
- />
- </el-form-item>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </template>
- <template #countryId>
- <div>
- <el-select
- v-model="formData.dataTwo.countryId"
- placeholder="国家"
- @change="(val) => getCityData(val, '20', true)"
- style="width: 100%"
- >
- <el-option
- v-for="item in countryData"
- :label="item.chineseName"
- :value="item.id"
- >
- </el-option>
- </el-select>
- </div>
- </template>
- <template #provinceId>
- <div style="width: 100%">
- <selectCity
- placeholder="省/洲"
- @change="(val) => getCityData(val, '30', true)"
- addressId="provinceId"
- addressName="provinceName"
- v-model="formData.dataTwo"
- :data="provinceData"
- >
- </selectCity>
- </div>
- </template>
- <template #cityId>
- <div style="width: 100%">
- <selectCity
- placeholder="城市"
- addressId="cityId"
- addressName="cityName"
- v-model="formData.dataTwo"
- :data="cityData"
- >
- </selectCity>
- </div>
- </template>
- </byForm>
- <template #footer>
- <el-button @click="dialogVisibleTwo = false" size="large"
- >取 消</el-button
- >
- <el-button
- type="primary"
- @click="submitFormTwo()"
- size="large"
- :loading="loadingTwo"
- >
- 确 定
- </el-button>
- </template>
- </el-dialog>
- <el-dialog
- :title="'高级检索'"
- v-model="dialogVisibleThree"
- width="500px"
- destroy-on-close
- >
- <el-form
- :model="sourceList.pagination"
- label-width="100px"
- label-position="top"
- >
- <el-form-item label="采购单号">
- <el-input
- v-model="sourceList.pagination.contractCode"
- placeholder="请输入"
- />
- </el-form-item>
- <el-form-item label="供应商">
- <el-select
- v-model="sourceList.pagination.supplyId"
- placeholder="请选择"
- style="width: 100%"
- >
- <el-option
- v-for="item in supplierData"
- :label="item.name"
- :value="item.id"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="收货仓库">
- <el-select
- v-model="sourceList.pagination.receiptWarehouseId"
- placeholder="请选择"
- style="width: 100%"
- >
- <el-option
- v-for="item in warehouseList"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="采购金额">
- <el-row>
- <el-col :span="8">
- <el-input-number
- v-model="sourceList.pagination.startAmount"
- placeholder="请输入"
- :controls="false"
- :min="1"
- :precision="2"
- style="width: 100%"
- onmousewheel="return false;"
- />
- </el-col>
- <el-col :span="2" style="text-align: center"> 到 </el-col>
- <el-col :span="8">
- <el-input-number
- v-model="sourceList.pagination.endAmount"
- placeholder="请输入"
- :controls="false"
- :min="1"
- :precision="2"
- style="width: 100%"
- onmousewheel="return false;"
- />
- </el-col>
- </el-row>
- </el-form-item>
- <el-form-item label="采购人">
- <el-select
- v-model="sourceList.pagination.purchaseUserId"
- placeholder="请选择"
- style="width: 100%"
- >
- <el-option
- v-for="item in userList"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="采购时间">
- <!-- <el-date-picker
- v-model="sourceList.pagination.arr"
- type="datetimerange"
- range-separator="到"
- start-placeholder="请选择"
- end-placeholder="请选择"
- /> -->
- <el-date-picker
- v-model="sourceList.pagination.arr"
- type="daterange"
- range-separator="到"
- start-placeholder="请选择"
- end-placeholder="请选择"
- value-format="YYYY-MM-DD HH:mm:ss"
- />
- </el-form-item>
- <el-row>
- <el-col :span="7">
- <el-form-item label="采购状态">
- <el-select
- v-model="sourceList.pagination.purchaseStatus"
- placeholder="请选择"
- style="width: 100%"
- >
- <el-option
- v-for="item in statusData"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="1"></el-col>
- <el-col :span="7">
- <el-form-item label="到货状态">
- <el-select
- v-model="sourceList.pagination.arrivalStatus"
- placeholder="请选择"
- style="width: 100%"
- >
- <el-option
- v-for="item in arrivalStatus"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="1"></el-col>
- <el-col :span="7">
- <el-form-item label="付款状态">
- <el-select
- v-model="sourceList.pagination.payStatus"
- placeholder="请选择"
- style="width: 100%"
- >
- <el-option
- v-for="item in paymentStatus"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <template #footer>
- <el-button @click="handleReset" size="large">重置</el-button>
- <el-button @click="handleQuery" type="primary" size="large"
- >搜索</el-button
- >
- </template>
- </el-dialog>
- <!-- <el-drawer v-model="dialogVisibleThree" direction="rtl">
- <template #header>
- <h4>高级检索</h4>
- </template>
- <template #default>
- <byForm
- :formConfig="formConfig"
- :formOption="ListOption"
- v-model="sourceList.pagination"
- >
- <template #slot> 可自定义所需功能 </template>
- </byForm>
- </template>
- <template #footer>
- <div style="flex: auto">
- <el-button @click="handleReset" size="large">重置</el-button>
- <el-button @click="handleQuery" type="primary" size="large"
- >搜索</el-button
- >
- </div>
- </template>
- </el-drawer> -->
- </div>
- </template>
-
- <script setup>
- import { ElMessage, ElMessageBox } from "element-plus";
- import byTable from "@/components/byTable/index";
- import byForm from "@/components/byForm/index";
- import { computed } from "vue";
- import selectCity from "@/components/selectCity/index.vue";
- import useUserStore from "@/store/modules/user";
- const loading = ref(false);
- const loadingTwo = ref(false);
- const submitLoading = ref(false);
- const sourceList = ref({
- data: [],
- pagination: {
- total: 3,
- pageNum: 1,
- pageSize: 10,
- arr: [],
- },
- });
- const dialogVisible = ref(false);
- const dialogVisibleOne = ref(false);
- const dialogVisibleTwo = ref(false);
- const dialogVisibleThree = ref(false);
- const modalType = ref("add");
- let rules = ref({
- deliverGoodsId: [
- { required: true, message: "请选择快递单号", trigger: "change" },
- ],
- logisticsCompanyCode: [
- { required: true, message: "请选择物流公司", trigger: "change" },
- ],
- code: [{ required: true, message: "请输入物流/快递单号", trigger: "blur" }],
- deliverGoodsQuantity: [
- { required: true, message: "请输入本次发货", trigger: "blur" },
- ],
- aa: [{ required: true, message: "请输入退货数量", trigger: "blur" }],
- });
- let rulesTwo = ref({
- contacts: [{ required: true, message: "请输入收件人", trigger: "blur" }],
- phone: [{ required: true, message: "请输入联系电话", trigger: "blur" }],
- countryId: [{ required: true, message: "请选择国家", trigger: "change" }],
- quantity: [{ required: true, message: "请输入退货数量", trigger: "blur" }],
- detailedAddress: [
- { required: true, message: "请输入详细地址", trigger: "blur" },
- ],
- });
- const { proxy } = getCurrentInstance();
- const arrivalStatus = [
- {
- label: "未到货",
- value: "0",
- },
- {
- label: "部分到货",
- value: "10",
- },
- {
- label: "已到货",
- value: "20",
- },
- ];
- const statusData = ref([
- {
- label: "审批中",
- value: "10",
- },
- {
- label: "驳回",
- value: "20",
- },
- {
- label: "已采购",
- value: "30",
- },
- {
- label: "结束",
- value: "99",
- },
- {
- label: "已作废",
- value: "88",
- },
- ]);
- const paymentStatus = ref([
- {
- label: "未付款",
- value: "0",
- },
- {
- label: "部分付款",
- value: "10",
- },
- {
- label: "已付款",
- value: "20",
- },
- ]);
- const inRransitData = ref([
- {
- label: "有",
- value: "1",
- },
- {
- label: "无",
- value: "0",
- },
- ]);
- const selectConfig = reactive([
- {
- label: "采购状态",
- prop: "purchaseStatus",
- data: statusData.value,
- },
- {
- label: "到货状态",
- prop: "arrivalStatus",
- data: arrivalStatus,
- },
- {
- label: "付款状态",
- prop: "payStatus",
- data: paymentStatus.value,
- },
- {
- label: "有无在途",
- prop: "isTransit",
- data: inRransitData.value,
- },
- ]);
- const config = computed(() => {
- return [
- {
- attrs: {
- label: "采购单号",
- prop: "contractCode",
- slot: "contractCode",
- },
- },
- {
- attrs: {
- label: "供应商",
- prop: "supplyName",
- width: 180,
- },
- },
- {
- attrs: {
- label: "收货仓库",
- prop: "receiptWarehouseName",
- },
- },
- {
- attrs: {
- label: "采购金额",
- prop: "amount",
- },
- render(amount) {
- return proxy.moneyFormat(amount, 2);
- },
- },
- {
- attrs: {
- label: "采购人",
- prop: "purchaseName",
- width: 150,
- },
- },
- {
- attrs: {
- label: "采购时间",
- prop: "createTime",
- width: 160,
- },
- },
- {
- attrs: {
- label: "采购状态",
- prop: "purchaseStatus",
- },
- render(status) {
- const current = statusData.value.find((x) => x.value == status);
- if (current) return current.label;
- },
- },
- {
- attrs: {
- label: "到货状态",
- prop: "arrivalStatus",
- slot: "arrivalStatus",
- },
- },
- {
- attrs: {
- label: "付款状态",
- prop: "payStatus",
- },
- render(status) {
- return proxy.dictValueLabel(status, paymentStatus.value);
- },
- },
- {
- attrs: {
- label: "操作",
- slot: "btn",
- width: "260",
- align: "center",
- fixed: "right",
- },
- },
- ];
- });
- let formData = reactive({
- data: {},
- dataOne: {},
- dataTwo: {},
- });
- const formOption = reactive({
- inline: true,
- labelWidth: 100,
- itemWidth: 100,
- });
- const byform = ref(null);
- const byformTwo = ref(null);
- let formConfig = reactive([]);
- let formConfigOne = computed(() => [
- {
- type: "title",
- title: "基础信息",
- },
- {
- type: "input",
- prop: "supplyName",
- label: "供应商",
- disabled: true,
- itemWidth: 50,
- },
- {
- type: "input",
- prop: "purchaseCode",
- label: "采购单号",
- disabled: true,
- itemWidth: 50,
- },
- {
- type: "title",
- title: "采购明细",
- },
- {
- type: "slot",
- slotName: "detailSlot",
- label: "",
- },
- ]);
- let formConfigTwo = computed(() => [
- {
- type: "title",
- title: "基础信息",
- },
- {
- type: "input",
- prop: "supplyName",
- label: "供应商",
- disabled: true,
- itemWidth: 50,
- },
- {
- type: "input",
- prop: "purchaseCode",
- label: "采购单号",
- disabled: true,
- itemWidth: 50,
- },
- {
- type: "title",
- title: "采购明细",
- },
- {
- type: "slot",
- slotName: "detailSlot",
- label: "",
- },
- {
- type: "title",
- title: "收货信息",
- },
- {
- type: "input",
- prop: "contacts",
- label: "收件人",
- itemWidth: 20,
- placeholder: "收件人",
- },
- {
- type: "input",
- prop: "phone",
- label: " ",
- itemWidth: 80,
- placeholder: "联系电话",
- style: {
- width: "30%",
- },
- },
- {
- type: "slot",
- slotName: "countryId",
- prop: "countryId",
- label: "收件地址",
- itemWidth: 33.33,
- },
- {
- type: "slot",
- slotName: "provinceId",
- label: " ",
- itemWidth: 33.33,
- },
- {
- type: "slot",
- slotName: "cityId",
- prop: "cityId",
- label: " ",
- itemWidth: 33.33,
- },
- {
- type: "input",
- itemType: "textarea",
- prop: "detailedAddress",
- },
- ]);
- const logisticsData = ref([]);
- const getLogisticsData = (row) => {
- proxy.post("/companyInfo/list", { pageNum: 1, pageSize: 999 }).then((res) => {
- logisticsData.value = res.reverse();
- logisticsData.value = logisticsData.value.map((x) => ({
- label: x.name,
- value: x.code,
- }));
- });
- };
- const configData = computed(() => [
- [
- {
- type: "title",
- title: "基础信息",
- },
- {
- type: "input",
- prop: "supplyName",
- label: "供应商",
- disabled: true,
- itemWidth: 50,
- },
- {
- type: "input",
- prop: "purchaseCode",
- label: "采购单号",
- disabled: true,
- itemWidth: 50,
- },
- {
- type: "select",
- label: "物流信息",
- prop: "logisticsCompanyCode",
- filterable: true,
- data: logisticsData.value,
- itemWidth: 50,
- style: {
- width: "100%",
- },
- },
- {
- type: "input",
- label: " ",
- prop: "code",
- placeholder: "物流/快递单号",
- itemWidth: 50,
- },
- {
- type: "title",
- title: "发货明细",
- },
- {
- type: "slot",
- slotName: "detailSlot",
- label: "",
- },
- ],
- [
- {
- type: "title",
- title: "基础信息",
- },
- {
- type: "input",
- prop: "supplyName",
- label: "供应商",
- disabled: true,
- itemWidth: 50,
- },
- {
- type: "input",
- prop: "purchaseCode",
- label: "采购单号",
- disabled: true,
- itemWidth: 50,
- },
- {
- type: "select",
- label: "物流/快递单号",
- prop: "deliverGoodsId",
- itemWidth: 50,
- style: {
- width: "100%",
- },
- },
- {
- type: "title",
- title: "发货明细",
- },
- {
- type: "slot",
- slotName: "detailSlot",
- label: "",
- },
- ],
- ]);
- const deliverData = ref([]);
- const getList = async (req) => {
- sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
- loading.value = true;
- proxy
- .post("/purchase/pageByWdly", sourceList.value.pagination)
- .then((message) => {
- sourceList.value.data = message.rows.map((x) => ({
- ...x,
- ...JSON.parse(x.victoriatouristJson),
- }));
- sourceList.value.pagination.total = message.total;
- setTimeout(() => {
- loading.value = false;
- }, 200);
- });
- };
- const submitForm = () => {
- byform.value.handleSubmit((valid) => {
- if (modalType.value === "add") {
- const list = formData.data.deliverGoodsDetailsList;
- const total = list.reduce(
- (total, x) => (total += Number(x.deliverGoodsQuantity)),
- 0
- );
- if (!(total > 0)) {
- return ElMessage({
- message: `本次发货不能为0!`,
- type: "info",
- });
- }
- // for (let i = 0; i < list.length; i++) {
- // const e = list[i];
- // if (
- // Number(e.alreadyDeliverGoodsQuantity) +
- // Number(e.deliverGoodsQuantity) >
- // Number(e.count)
- // ) {
- // return ElMessage({
- // message: `本次发货加累计发货不可大于采购数量!`,
- // type: "info",
- // });
- // }
- // }
- submitLoading.value = true;
- formData.data.deliverGoodsDetailsList = list.map((x) => ({
- purchaseDetailId: x.purchaseDetailId,
- deliverGoodsQuantity: x.deliverGoodsQuantity,
- }));
- proxy.post("/deliverGoods/add", formData.data).then((res) => {
- ElMessage({
- message: `操作成功!`,
- type: "success",
- });
- dialogVisible.value = false;
- submitLoading.value = false;
- getList();
- });
- } else if (modalType.value === "edit") {
- submitLoading.value = true;
- formData.data.arrivalDetailList = formData.data.arrivalDetailList.map(
- (x) => ({
- bussinessId: x.bussinessId,
- purchaseDetailId: x.purchaseDetailId,
- deliverGoodsDetailsId: x.deliverGoodsDetailsId,
- count: x.deliverGoodsQuantity,
- })
- );
- const victoriatouristJson = {
- deliverGoodsId: formData.data.deliverGoodsId,
- logisticsCompanyCode: formData.data.logisticsCompanyCode,
- code: formData.data.code,
- };
- formData.data.victoriatouristJson = JSON.stringify(victoriatouristJson);
- proxy.post("/arrival/addByWdly", formData.data).then((res) => {
- ElMessage({
- message: `操作成功!`,
- type: "success",
- });
- dialogVisible.value = false;
- submitLoading.value = false;
- getList();
- });
- }
- });
- };
- const submitFormTwo = () => {
- byformTwo.value.handleSubmit((valid) => {
- loadingTwo.value = true;
- let submitData = { ...formData.dataTwo };
- submitData.purchaseBackDetailsList = submitData.purchaseBackDetailsList.map(
- (x) => ({
- purchaseDetailsId: x.id,
- productId: x.bussinessId,
- quantity: x.quantity,
- })
- );
- proxy.post("/purchaseBack/add", submitData).then(
- (res) => {
- ElMessage({
- message: `操作成功!`,
- type: "success",
- });
- dialogVisibleTwo.value = false;
- loadingTwo.value = false;
- getList();
- },
- (err) => {
- loadingTwo.value = false;
- }
- );
- });
- };
- const getDtl = (row) => {
- modalType.value = "edit";
- proxy.post("/productionProcesses/detail", { id: row.id }).then((res) => {
- formData.data = res;
- dialogVisible.value = true;
- });
- };
- const handleEdit = (row, status) => {
- let purchaseStatusName = status == 88 ? "作废" : "结束";
- const data = { ...row, purchaseStatus: status };
- // 弹窗提示是否删除
- ElMessageBox.confirm(
- `此操作将${purchaseStatusName}该数据, 是否继续?`,
- "提示",
- {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- }
- ).then(() => {
- // 删除
- proxy.post("/purchase/edit", data).then((res) => {
- ElMessage({
- message: `${purchaseStatusName}成功`,
- type: "success",
- });
- getList();
- });
- });
- };
- const handleArrival = (row, type) => {
- modalType.value = type;
- if (type === "add") {
- formConfig = configData.value[0];
- proxy.post("/deliverGoodsDetails/detail", { id: row.id }).then((res) => {
- formData.data = {
- purchaseId: row.id,
- supplyName: row.supplyName,
- purchaseCode: row.contractCode,
- supplyId: res.supplyId,
- code: "",
- logisticsCompanyCode: "",
- deliverGoodsDetailsList: res.map((x) => ({
- ...x,
- purchaseDetailId: x.id,
- alreadyDeliverGoodsQuantity: x.deliverGoodsQuantity,
- deliverGoodsQuantity:
- Number(x.count) - Number(x.deliverGoodsQuantity),
- })),
- };
- dialogVisible.value = true;
- });
- } else if (type === "edit") {
- formConfig = configData.value[1];
- proxy.post("/deliverGoods/list", { id: row.id }).then((res) => {
- deliverData.value = res;
- formConfig[3].data = res.map((x) => ({
- ...x,
- label: x.code,
- value: x.id,
- }));
- formData.data = {
- purchaseId: row.id,
- supplyName: row.supplyName,
- purchaseCode: row.contractCode,
- supplyId: row.supplyId,
- code: "",
- logisticsCompanyCode: "",
- deliverGoodsId: "",
- arrivalDetailList: [],
- };
- dialogVisible.value = true;
- });
- }
- };
- watch(
- () => formData.data.deliverGoodsId,
- (val) => {
- if (val) {
- const current = deliverData.value.find((x) => x.id === val);
- formData.data.logisticsCompanyCode = current
- ? current.logisticsCompanyCode
- : "";
- formData.data.code = current ? current.code : "";
- proxy.post("/deliverGoods/detail", { id: val }).then((res) => {
- formData.data.arrivalDetailList = res.map((x) => ({
- count: x.count,
- productName: x.name,
- productSpec: x.spec,
- productUnit: x.unit,
- productType: x.type,
- productCode: x.code,
- bussinessId: x.productId,
- purchaseDetailId: x.purchaseDetailId,
- deliverGoodsDetailsId: x.id,
- transitQuantity: x.transitQuantity,
- deliverGoodsQuantity: x.deliverGoodsQuantity,
- productDefinition: x.definition,
- }));
- });
- }
- }
- );
- const handleClickContractCode = (row) => {
- proxy.$router.push({
- path: "/platform_manage/process/processApproval",
- query: {
- flowKey: row.processInstanceId,
- id: row.flowId,
- businessId: row.id,
- processType: 20,
- },
- });
- };
- const handleClickArrivalStatus = (row) => {
- proxy
- .post("/deliverGoods/arrivalDetail", { purchaseId: row.id })
- .then((res) => {
- formData.dataOne = {
- supplyName: row.supplyName,
- purchaseCode: row.contractCode,
- purchaseDetailVoList: res.purchaseDetailVoList,
- };
- dialogVisibleOne.value = true;
- });
- };
- const handleReturnGoods = (row) => {
- proxy.post("/purchase/detail", { id: row.id }).then((res) => {
- formData.dataTwo = {
- purchaseId: row.id,
- supplyName: row.supplyName,
- purchaseCode: row.contractCode,
- countryId: "44",
- purchaseBackDetailsList: res.purchaseDetailList.map((x) => ({
- ...x,
- planArrivalTime: res.planArrivalTime,
- subscribeCode: res.subscribeCode,
- })),
- };
- getCityData(formData.dataTwo.countryId, "20");
- dialogVisibleTwo.value = true;
- });
- };
- const countryData = ref([]);
- const provinceData = ref([]);
- const cityData = ref([]);
- const getCityData = (id, type, flag) => {
- proxy.post("/customizeArea/list", { parentId: id }).then((res) => {
- if (type === "20") {
- provinceData.value = res;
- if (flag) {
- formData.data.provinceId = "";
- formData.data.provinceName = "";
- formData.data.cityId = "";
- formData.data.cityName = "";
- }
- } else if (type === "30") {
- cityData.value = res;
- if (flag) {
- formData.data.cityId = "";
- formData.data.cityName = "";
- }
- } else {
- countryData.value = res;
- }
- });
- };
- const productUnit = ref([]);
- const supplierData = ref([]);
- const warehouseList = ref([]);
- const userList = ref([]);
- const getDict = () => {
- proxy.getDictOne(["unit"]).then((res) => {
- productUnit.value = res["unit"].map((x) => ({
- label: x.dictValue,
- value: x.dictKey,
- }));
- });
- proxy
- .post("/supplierInfo/page", { pageNum: 1, pageSize: 9999 })
- .then((res) => {
- supplierData.value = res.rows;
- });
- proxy.post("/warehouse/page", { pageNum: 1, pageSize: 999 }).then((res) => {
- if (res.rows && res.rows.length > 0) {
- warehouseList.value = res.rows.map((item) => {
- return {
- label: item.name,
- value: item.id,
- };
- });
- }
- });
- proxy
- .get("/tenantUser/list", {
- pageNum: 1,
- pageSize: 10000,
- tenantId: useUserStore().user.tenantId,
- })
- .then((res) => {
- userList.value = res.rows.map((item) => {
- return {
- label: item.nickName,
- value: item.userId,
- };
- });
- });
- };
- getCityData("0");
- getList();
- getLogisticsData();
- getDict();
- const handleQuery = () => {
- if (
- sourceList.value.pagination.arr &&
- sourceList.value.pagination.arr.length > 1
- ) {
- sourceList.value.pagination.purchaseStartTime =
- sourceList.value.pagination.arr[0];
- sourceList.value.pagination.purchaseEndTime =
- sourceList.value.pagination.arr[1];
- }
- dialogVisibleThree.value = false;
- getList();
- };
- const handleReset = () => {
- sourceList.value.pagination = {
- pageNum: sourceList.value.pagination.pageNum,
- pageSize: sourceList.value.pagination.pageSize,
- arr: [],
- };
- handleQuery();
- };
- </script>
-
- <style lang="scss" scoped>
- .tenant {
- padding: 20px;
- }
- </style>
|