123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288 |
- <!-- 采购需求处理-详情 -->
- <script>
- import useColumns from "./columns";
- import {
- getSummaryDetail,
- shutDownSummary,
- editSummaryMx,
- reloadBatch,
- } from "@/api/purchase/DemandSummary.js";
- export default {
- name: "DemandSummaryAdd",
- props: {
- dict: {
- type: Object,
- },
- data: {
- type: Object,
- },
- },
- components: {
- CloseLineBtn: () => import("../closeLine/index.vue"),
- ElSuperUxTable: () => import("@/components/super-ux-table/index.vue"),
- ElPopoverSelectV2: () => import("@/components/popover-select-v2/index.vue"),
- },
- data() {
- const { TableColumns } = useColumns();
- return {
- width: "100%",
- title: "详 情",
- isEdit: false,
- visible: false,
- loading: false,
- params: [],
- TableColumns,
- selectData: [],
- };
- },
- computed: {
- height: {
- get() {
- return window.innerHeight - 150;
- },
- set() {},
- },
- },
- methods: {
- onHide() {
- this.visible = false;
- this.params = [];
- this.selectData = [];
- this.$emit("refresh");
- },
- setVisible(prop) {
- this.visible = prop;
- },
- beforeOpen() {
- this.fetchItem();
- },
- async fetchItem() {
- try {
- this.loading = true;
- let { code, msg, data } = await getSummaryDetail({
- ...this.$props.data,
- });
- if (code == 200) {
- this.params = data;
- }
- } catch (error) {
- } finally {
- this.loading = false;
- }
- },
- useSelect(prop) {
- this.selectData = prop;
- },
- // 编辑
- useEdit() {
- this.isEdit = true;
- },
- // 取消
- useCancel() {
- this.isEdit = false;
- this.fetchItem();
- },
- // 保存
- async useSave() {
- try {
- const params = [...this.params];
- console.log(params, "params");
- let { code, msg } = await editSummaryMx(params);
- if (code == 200) {
- this.$modal.notifySuccess(msg);
- this.isEdit = false;
- this.fetchItem();
- }
- } catch (error) {}
- },
- // 重取批量
- refetchBatch() {
- this.$modal
- .confirm("是否更新明细的最小包装量,最小订货量,最小批量?")
- .then(async () => {
- let ids = this.params.map((item) => item.demandItemId);
- let { code, msg } = await reloadBatch(ids);
- if (code == 200) {
- this.$modal.notifySuccess(msg);
- this.fetchItem();
- }
- })
- .catch(() => {});
- },
- // 补单标识
- changeReplenishment(prop, row) {
- if (prop === "N") {
- row.additionalSupplier = null;
- row.additionalSupplierName = null;
- }
- },
- },
- created() {},
- };
- </script>
- <template>
- <el-drawer
- v-loading="loading"
- v-bind="$attrs"
- v-on="$listeners"
- :size="width"
- :show-close="false"
- :visible.sync="visible"
- destroy-on-close
- @close="onHide"
- @open="beforeOpen"
- >
- <div
- slot="title"
- style="display: flex; justify-content: space-between; align-items: center"
- >
- <h3>{{ title }}</h3>
- <el-row class="my-4" style="text-align: right">
- <el-col v-if="isEdit">
- <el-button-group>
- <el-button type="primary" :size="$attrs.size" @click="useSave"
- >保 存</el-button
- >
- <el-button :size="$attrs.size" @click="useCancel">取 消</el-button>
- </el-button-group>
- </el-col>
- <el-col v-else>
- <el-button-group>
- <el-button type="primary" :size="$attrs.size" @click="useEdit"
- >编 辑</el-button
- >
- </el-button-group>
- <el-button-group>
- <close-line-btn
- :size="$attrs.size"
- :select-data="selectData"
- @refresh="fetchItem"
- ></close-line-btn>
- </el-button-group>
- <el-button-group>
- <el-button :size="$attrs.size" @click="refetchBatch"
- >重取批量</el-button
- >
- </el-button-group>
- <el-button-group>
- <el-button :size="$attrs.size" :loading="loading" @click="onHide">
- 返回
- </el-button>
- </el-button-group>
- </el-col>
- </el-row>
- </div>
- <el-super-ux-table
- v-model="params"
- :dict="dict"
- :height="height"
- :size="$attrs.size"
- :columns="TableColumns"
- index
- checkbox
- convenitentOperation
- storage-key="DemandSummaryDetailsSuperTable"
- @row-select="useSelect"
- style="padding: 0 20px 20px"
- >
- <!-- 紧急标识-->
- <template slot="isUrgency" slot-scope="scope">
- <component
- v-bind="scope.attr"
- v-model="scope.row[scope.item.key]"
- :size="$attrs.size"
- :source.sync="scope.row"
- :disabled="!isEdit || scope.row.status !== '1'"
- >
- <el-option
- v-for="item in dict.type[scope.attr.dictName]"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </component>
- </template>
- <!-- 补单标识-->
- <template slot="isReplenishment" slot-scope="scope">
- <component
- v-bind="scope.attr"
- v-model="scope.row[scope.item.key]"
- :size="$attrs.size"
- :source.sync="scope.row"
- :disabled="!isEdit || scope.row.status !== '1'"
- @change="(val) => changeReplenishment(val, scope.row)"
- >
- <el-option
- v-for="item in dict.type[scope.attr.dictName]"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </component>
- </template>
- <!-- 收货仓库-->
- <template slot="deliveryWarehouseName" slot-scope="scope">
- <component
- v-bind="scope.attr"
- v-model="scope.row[scope.item.key]"
- :size="$attrs.size"
- :source.sync="scope.row"
- :disabled="!isEdit || scope.row.status !== '1'"
- >
- </component>
- </template>
- <!-- 收货货位-->
- <template slot="deliveryAllocationName" slot-scope="scope">
- <component
- v-bind="scope.attr"
- v-model="scope.row[scope.item.key]"
- :size="$attrs.size"
- :source.sync="scope.row"
- :disabled="!isEdit || scope.row.status !== '1'"
- >
- </component>
- </template>
- <!-- 补单供应商-->
- <template slot="additionalSupplierName" slot-scope="scope">
- <component
- v-bind="scope.attr"
- v-model="scope.row[scope.item.key]"
- :size="$attrs.size"
- :source.sync="scope.row"
- :disabled="
- !isEdit ||
- scope.row.status !== '1' ||
- (isEdit && scope.row.isReplenishment === 'N')
- "
- >
- </component>
- </template>
- <!-- 采购组织-->
- <template slot="orgName" slot-scope="scope">
- <component
- v-bind="scope.attr"
- v-model="scope.row[scope.item.key]"
- :size="$attrs.size"
- :source.sync="scope.row"
- :disabled="!isEdit || scope.row.status !== '1'"
- >
- </component>
- </template>
- </el-super-ux-table>
- </el-drawer>
- </template>
- <style scoped>
- .el-button-group + .el-button-group {
- margin: 0 0 0 8px;
- }
- >>> .el-drawer__header {
- margin-bottom: 0;
- padding: 5px 20px;
- }
- </style>
|