123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398 |
- <template>
- <div>
- <el-card class="box-card">
- <test :form-config="btnForm"> </test>
- <query
- :selectConfig="selectConfig"
- :req="queryParams"
- :isShowMore="true"
- @handleQuery="handleQuery"
- @handleMore="
- () => {
- queryDialog = true;
- }
- "
- ></query>
- <el-table :data="tableList" v-loading="loading">
- <el-table-column
- :label="$t('product_material.supply.supplyType')"
- align="center"
- prop="applicationName"
- />
- <el-table-column
- :label="$t('product_material.supply.supplyName')"
- align="center"
- prop="applicationName"
- />
- <el-table-column
- :label="$t('product_material.product.productType')"
- align="center"
- prop="applicationName"
- />
- <el-table-column
- :label="$t('product_material.product.productCode')"
- align="center"
- prop="applicationName"
- />
- <el-table-column
- :label="$t('product_material.product.productName')"
- align="center"
- prop="applicationName"
- />
- <el-table-column
- :label="$t('product_material.supply.priceMaintenance.supplyPrice')"
- align="center"
- prop="applicationName"
- />
- <el-table-column :label="$t('operation')" align="center" width="120">
- <template slot-scope="scope">
- <el-button type="text" @click="handleEdit(scope.row)"
- >{{ $t("edit") }}
- </el-button>
- <el-button type="text" @click="handleDelete(scope.row)"
- >{{ $t("delete") }}
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- <pagination
- v-show="total > 0"
- :total="total"
- :page.sync="queryParams.pageNum"
- :limit.sync="queryParams.pageSize"
- @pagination="getList"
- />
- <el-dialog
- :title="
- titleText === 'add'
- ? $t('product_material.supply.priceMaintenance.supplyPriceAdd')
- : $t('product_material.supply.priceMaintenance.supplyPriceEdit')
- "
- :visible.sync="open"
- v-if="open"
- width="50%"
- top="60px"
- >
- <add-supply-price
- :form="form"
- :supplySelectList="supplySelectList"
- @submit="handleSubmit"
- @cancel="handleCancel"
- ref="addSupplyPrice"
- ></add-supply-price>
- </el-dialog>
- <el-dialog
- :title="$t('seniorQuery')"
- :visible.sync="queryDialog"
- v-if="queryDialog"
- width="30%"
- >
- <el-form
- label-position="top"
- :model="queryParams"
- ref="queryForm"
- label-width="100px"
- >
- <el-row>
- <el-col :span="12">
- <el-form-item
- :label="$t('product_material.supply.supplyName')"
- prop="type"
- >
- <el-select
- v-model="queryParams.type"
- :placeholder="$t('pleaseSelect')"
- style="width: 100%"
- >
- <el-option
- v-for="item in options"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="12">
- <el-form-item
- :label="$t('product_material.supply.priceMaintenance.goodCode')"
- prop="type"
- >
- <el-select
- v-model="queryParams.type"
- :placeholder="$t('pleaseSelect')"
- style="width: 100%"
- >
- <el-option
- v-for="item in options"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-form-item
- :label="$t('product_material.supply.priceMaintenance.goodName')"
- prop="name"
- >
- <el-input
- v-model="queryParams.name"
- :placeholder="$t('pleaseInput')"
- ></el-input>
- </el-form-item>
- <el-row>
- <el-col :span="12">
- <el-form-item
- :label="$t('product_material.supply.priceMaintenance.goodType')"
- prop="code"
- >
- <el-select
- v-model="queryParams.type"
- :placeholder="$t('pleaseSelect')"
- style="width: 100%"
- >
- <el-option
- v-for="item in options"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- >
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <div style="text-align: center">
- <el-button size="small" @click="queryDialog = false"
- >{{ $t("cancel") }}
- </el-button>
- <el-button type="primary" size="small" @click="handleQuery">
- {{ $t("submit") }}</el-button
- >
- </div>
- </el-form>
- </el-dialog>
- </el-card>
- </div>
- </template>
- <script>
- import test from "@/components/form-test/index.vue";
- import query from "@/components/query/index.vue";
- import { supplySelect } from "@/api/product-material/supply/index.js";
- import * as API from "@/api/product-material/supply/priceMaintenance.js";
- import addSupplyPrice from "./addSupplyPrice.vue";
- export default {
- components: {
- test,
- query,
- addSupplyPrice,
- },
- data() {
- return {
- supplySelectList: [],
- productTypeList: [],
- queryParams: {
- pageNum: 1,
- pageSize: 10,
- keyword: "",
- supplierId: "",
- materialId: "",
- supplierName: "",
- materialName: "",
- materialCode: "",
- materialType: "",
- },
- btnForm: {
- otherButton: {
- list: [
- {
- name: this.$t(
- "product_material.supply.priceMaintenance.supplyPriceAdd"
- ),
- methodsText: "add",
- type: "primary",
- add: () => {
- this.supplyPriceAdd();
- },
- },
- // {
- // name: this.$t("product_material.supply.priceMaintenance.back"),
- // methodsText: "back",
- // type: "defualt",
- // back: () => {
- // this.back();
- // },
- // },
- ],
- },
- },
- selectConfig: [
- {
- label: this.$t("product_material.product.productType"),
- prop: "type",
- data: [],
- },
- {
- label: this.$t("product_material.supply.supplyType"),
- prop: "type",
- data: [],
- },
- ],
- queryDialog: false,
- tableList: [],
- loading: false,
- total: null,
- open: false,
- titleText: "add",
- form: {
- supplierId: "",
- materialId: "",
- price: "",
- id: "",
- },
- };
- },
- created() {
- const businessDictData = JSON.parse(
- window.localStorage.getItem("businessDict")
- );
- this.productTypeList = businessDictData.find(
- (item) => item.code === "productType"
- ).children;
- this.selectConfig[0].data = this.productTypeList.map((item) => ({
- label: item.dictValue,
- value: item.dictKey,
- }));
- this.supplyTypeList = businessDictData.find(
- (item) => item.code === "supplyType"
- ).children;
- this.selectConfig[1].data = this.supplyTypeList.map((item) => ({
- label: item.dictValue,
- value: item.dictKey,
- }));
- supplySelect({ name: "", type: "", code: "" }).then((res) => {
- this.supplySelectList = res.data.data;
- });
- this.getList();
- },
- methods: {
- back() {
- this.$router.push({
- path: "/product-material/supply/index",
- });
- },
- getList() {
- this.loading = true;
- API.supplyPriceList(this.queryParams).then(
- (res) => {
- this.tableList = res.data.data.records;
- this.total = res.data.data.total;
- this.loading = false;
- },
- (err) => {
- console.log("supplyPriceList: " + err);
- this.loading = false;
- }
- );
- },
- handleQuery() {
- this.getList();
- },
- supplyPriceAdd() {
- this.form = {
- supplierId: "",
- materialId: "",
- price: "",
- id: "",
- };
- this.titleText = "add";
- this.open = true;
- },
- handleCancel() {
- this.form = {
- supplierId: "",
- materialId: "",
- price: "",
- id: "",
- };
- this.open = false;
- },
- handleEdit(row) {
- this.titleText = "edit";
- this.form = row;
- this.open = true;
- },
- handleSubmit() {
- if (!this.form.id) {
- API.supplyPriceAdd(this.form).then(
- () => {
- this.msgSuccess(this.$t("addSuccess"));
- this.$refs.addSupplyPrice.loading = false;
- this.open = false;
- this.getList();
- },
- (err) => {
- console.log("supplyPriceAdd: " + err);
- this.$refs.addSupplyPrice.loading = false;
- }
- );
- } else {
- API.supplyPriceEdit(this.form).then(
- () => {
- this.msgSuccess(this.$t("editSuccess"));
- this.open = false;
- this.$refs.addSupplyPrice.loading = false;
- this.getList();
- },
- (err) => {
- console.log("supplyPriceEdit: " + err);
- this.$refs.addSupplyPrice.loading = false;
- }
- );
- }
- },
- handleDelete(row) {
- this.$confirm(this.$t("askDeleteData"), {
- confirmButtonText: this.$t("submitText"),
- cancelButtonText: this.$t("cancelText"),
- type: "warning",
- }).then(() => {
- API.supplyPriceDel({ id: row.id }).then(() => {
- this.msgSuccess(this.$t("deleteSuccess"));
- this.getList();
- });
- });
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .box-card {
- height: calc(100vh - 110px);
- overflow-y: auto;
- }
- </style>
|