|
@@ -1,11 +1,14 @@
|
|
<script>
|
|
<script>
|
|
-import { TableColumns, SearchColumns } from "./column";
|
|
|
|
|
|
+import { FormColumns, SearchColumns } from "./column";
|
|
import { LIST } from "@/api/business/purchase/catalogue";
|
|
import { LIST } from "@/api/business/purchase/catalogue";
|
|
-import { initPage, initParams } from "@/utils/init";
|
|
|
|
|
|
+import { initPage, initDicts, initParams } from "@/utils/init";
|
|
export default {
|
|
export default {
|
|
name: "PuchaseCatalogue",
|
|
name: "PuchaseCatalogue",
|
|
|
|
+ dicts: [...initDicts(SearchColumns), ...initDicts(FormColumns)],
|
|
components: {
|
|
components: {
|
|
- EditModel: () => import("./edit/index.vue"),
|
|
|
|
|
|
+ SeeModel: () => import("./see/index.vue"),
|
|
|
|
+ InvalidModel: () => import("./invalid/index.vue"),
|
|
|
|
+ EnableModel: () => import("./enable/index.vue"),
|
|
},
|
|
},
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
@@ -14,25 +17,34 @@ export default {
|
|
searchColumns: SearchColumns,
|
|
searchColumns: SearchColumns,
|
|
params: initParams(SearchColumns),
|
|
params: initParams(SearchColumns),
|
|
tableData: [],
|
|
tableData: [],
|
|
- tableColumns: TableColumns,
|
|
|
|
|
|
+ selectData: [],
|
|
|
|
+ tableColumns: FormColumns,
|
|
page: { pageNum: 1, pageSize: 10, total: 0 },
|
|
page: { pageNum: 1, pageSize: 10, total: 0 },
|
|
};
|
|
};
|
|
},
|
|
},
|
|
computed: {},
|
|
computed: {},
|
|
created() {
|
|
created() {
|
|
|
|
+ this.params.status = "0";
|
|
this.useQuery(this.params, this.page);
|
|
this.useQuery(this.params, this.page);
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
//
|
|
//
|
|
|
|
+ setSelectable(row) {
|
|
|
|
+ const { status } = row;
|
|
|
|
+ // 失效
|
|
|
|
+ if (status === "2") return false;
|
|
|
|
+ // other
|
|
|
|
+ else return true;
|
|
|
|
+ },
|
|
|
|
+ //
|
|
async fetchList(prop, page) {
|
|
async fetchList(prop, page) {
|
|
try {
|
|
try {
|
|
this.loading = true;
|
|
this.loading = true;
|
|
const { pageNum, pageSize } = page;
|
|
const { pageNum, pageSize } = page;
|
|
- const { code, rows, total } = await LIST({
|
|
|
|
- pageNum,
|
|
|
|
- pageSize,
|
|
|
|
- ...prop,
|
|
|
|
- });
|
|
|
|
|
|
+ const { code, rows, total } = await LIST(
|
|
|
|
+ { ...prop },
|
|
|
|
+ { pageNum, pageSize }
|
|
|
|
+ );
|
|
if (code === 200) {
|
|
if (code === 200) {
|
|
this.tableData = rows;
|
|
this.tableData = rows;
|
|
this.page.total = total;
|
|
this.page.total = total;
|
|
@@ -46,6 +58,7 @@ export default {
|
|
},
|
|
},
|
|
// 查 询
|
|
// 查 询
|
|
useQuery(prop, page) {
|
|
useQuery(prop, page) {
|
|
|
|
+ this.selectData = [];
|
|
this.fetchList(prop, page);
|
|
this.fetchList(prop, page);
|
|
},
|
|
},
|
|
// 重 置
|
|
// 重 置
|
|
@@ -54,12 +67,44 @@ export default {
|
|
this.params = initParams(SearchColumns);
|
|
this.params = initParams(SearchColumns);
|
|
this.useQuery(this.params, this.page);
|
|
this.useQuery(this.params, this.page);
|
|
},
|
|
},
|
|
- // 编 辑
|
|
|
|
- async useEdit(prop) {
|
|
|
|
- return;
|
|
|
|
- const { open } = this.$refs.EditModel;
|
|
|
|
|
|
+ // 选 择
|
|
|
|
+ useSelect(prop) {
|
|
|
|
+ this.selectData = prop;
|
|
|
|
+ },
|
|
|
|
+ // 明 细
|
|
|
|
+ async useSee(prop) {
|
|
|
|
+ const { id } = prop;
|
|
|
|
+ const { open } = this.$refs.SeeModel;
|
|
|
|
+ await open(id);
|
|
|
|
+ },
|
|
|
|
+ // 失 效
|
|
|
|
+ async useInvalid(prop) {
|
|
|
|
+ const { open } = this.$refs.InvalidModel;
|
|
await open(prop);
|
|
await open(prop);
|
|
},
|
|
},
|
|
|
|
+ hasPowerInvalid(prop) {
|
|
|
|
+ if (prop.length === 1) {
|
|
|
|
+ const [{ status }] = prop;
|
|
|
|
+ if (status === "2") return false;
|
|
|
|
+ else return true;
|
|
|
|
+ } else {
|
|
|
|
+ return !!prop.length;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ // 启 停
|
|
|
|
+ async useEnable(prop, status) {
|
|
|
|
+ const { open } = this.$refs.EnableModel;
|
|
|
|
+ await open(prop, status);
|
|
|
|
+ },
|
|
|
|
+ hasPowerEnable(prop) {
|
|
|
|
+ if (prop.length === 1) {
|
|
|
|
+ const [{ status }] = prop;
|
|
|
|
+ if (status === "2") return false;
|
|
|
|
+ else return true;
|
|
|
|
+ } else {
|
|
|
|
+ return !!prop.length;
|
|
|
|
+ }
|
|
|
|
+ },
|
|
},
|
|
},
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|
|
@@ -67,10 +112,23 @@ export default {
|
|
<template>
|
|
<template>
|
|
<el-card
|
|
<el-card
|
|
v-loading="loading"
|
|
v-loading="loading"
|
|
- style="width: calc(100% - 24px); height: 100%; margin: 10px"
|
|
|
|
|
|
+ style="
|
|
|
|
+ width: calc(100% - 20px);
|
|
|
|
+ height: 100%;
|
|
|
|
+ margin: 10px;
|
|
|
|
+ padding: 0 20px 20px 0;
|
|
|
|
+ "
|
|
:body-style="{ padding: 0 }"
|
|
:body-style="{ padding: 0 }"
|
|
>
|
|
>
|
|
- <!-- <see-drawer ref="SeeDrawerFef"></see-drawer> -->
|
|
|
|
|
|
+ <see-model ref="SeeModel"></see-model>
|
|
|
|
+ <invalid-model
|
|
|
|
+ ref="InvalidModel"
|
|
|
|
+ @success="useQuery(params, page)"
|
|
|
|
+ ></invalid-model>
|
|
|
|
+ <enable-model
|
|
|
|
+ ref="EnableModel"
|
|
|
|
+ @success="useQuery(params, page)"
|
|
|
|
+ ></enable-model>
|
|
<!-- <add-drawer ref="AddDrawerFef" @close="resetList"></add-drawer> -->
|
|
<!-- <add-drawer ref="AddDrawerFef" @close="resetList"></add-drawer> -->
|
|
<!-- <edit-model ref="EditModel" @success="resetList"></edit-model> -->
|
|
<!-- <edit-model ref="EditModel" @success="resetList"></edit-model> -->
|
|
<el-form
|
|
<el-form
|
|
@@ -96,14 +154,24 @@ export default {
|
|
style="width: 100%"
|
|
style="width: 100%"
|
|
@keyup.enter.native="useQuery(params, page)"
|
|
@keyup.enter.native="useQuery(params, page)"
|
|
></el-input>
|
|
></el-input>
|
|
- <el-switch
|
|
|
|
- v-if="column.inputType === 'Switch'"
|
|
|
|
|
|
+ <el-select
|
|
|
|
+ v-if="column.inputType === 'Select'"
|
|
v-model="params[column.key]"
|
|
v-model="params[column.key]"
|
|
- active-value="1"
|
|
|
|
- inactive-value="0"
|
|
|
|
|
|
+ :disabled="column.disabled"
|
|
|
|
+ :clearable="column.clearable"
|
|
|
|
+ :placeholder="column.placeholder"
|
|
|
|
+ style="width: 100%"
|
|
|
|
+ @change="useQuery(params, page)"
|
|
@keyup.enter.native="useQuery(params, page)"
|
|
@keyup.enter.native="useQuery(params, page)"
|
|
>
|
|
>
|
|
- </el-switch>
|
|
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="item in dict.type[column.referName]"
|
|
|
|
+ :key="item.value"
|
|
|
|
+ :label="item.label"
|
|
|
|
+ :value="item.value"
|
|
|
|
+ >
|
|
|
|
+ </el-option>
|
|
|
|
+ </el-select>
|
|
<dr-popover-select
|
|
<dr-popover-select
|
|
v-if="column.inputType === 'PopoverSelect'"
|
|
v-if="column.inputType === 'PopoverSelect'"
|
|
v-model="params[column.key]"
|
|
v-model="params[column.key]"
|
|
@@ -116,6 +184,7 @@ export default {
|
|
:value-key="column.valueKey"
|
|
:value-key="column.valueKey"
|
|
:placeholder="column.placeholder"
|
|
:placeholder="column.placeholder"
|
|
:data-mapping="column.dataMapping"
|
|
:data-mapping="column.dataMapping"
|
|
|
|
+ @change="useQuery(params, page)"
|
|
@keyup.enter.native="useQuery(params, page)"
|
|
@keyup.enter.native="useQuery(params, page)"
|
|
>
|
|
>
|
|
</dr-popover-select>
|
|
</dr-popover-select>
|
|
@@ -130,21 +199,66 @@ export default {
|
|
查 询
|
|
查 询
|
|
</el-button>
|
|
</el-button>
|
|
<el-button :size="size" @click="useReset"> 重 置 </el-button>
|
|
<el-button :size="size" @click="useReset"> 重 置 </el-button>
|
|
|
|
+ <el-button
|
|
|
|
+ v-show="hasPowerInvalid(selectData)"
|
|
|
|
+ :size="size"
|
|
|
|
+ @click="useInvalid(selectData)"
|
|
|
|
+ >
|
|
|
|
+ 失 效
|
|
|
|
+ </el-button>
|
|
|
|
+ <el-button
|
|
|
|
+ v-show="hasPowerEnable(selectData)"
|
|
|
|
+ :size="size"
|
|
|
|
+ @click="useEnable(selectData, '0')"
|
|
|
|
+ >
|
|
|
|
+ 启 用
|
|
|
|
+ </el-button>
|
|
|
|
+ <el-button
|
|
|
|
+ v-show="hasPowerEnable(selectData)"
|
|
|
|
+ :size="size"
|
|
|
|
+ @click="useEnable(selectData, '2')"
|
|
|
|
+ >
|
|
|
|
+ 停 用
|
|
|
|
+ </el-button>
|
|
</el-row>
|
|
</el-row>
|
|
<el-table
|
|
<el-table
|
|
- @row-dblclick="useEdit"
|
|
|
|
- :data="tableData"
|
|
|
|
:size="size"
|
|
:size="size"
|
|
|
|
+ :data="tableData"
|
|
|
|
+ highlight-current-row
|
|
|
|
+ @row-click="useSelect([$event])"
|
|
|
|
+ @row-dblclick="useSee"
|
|
|
|
+ @selection-change="useSelect"
|
|
style="width: 100%; margin: 20px 0 0 0"
|
|
style="width: 100%; margin: 20px 0 0 0"
|
|
>
|
|
>
|
|
<el-table-column
|
|
<el-table-column
|
|
|
|
+ fixed
|
|
|
|
+ width="55"
|
|
|
|
+ align="center"
|
|
|
|
+ type="selection"
|
|
|
|
+ :selectable="setSelectable"
|
|
|
|
+ >
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column
|
|
v-for="(column, index) in tableColumns"
|
|
v-for="(column, index) in tableColumns"
|
|
:key="index"
|
|
:key="index"
|
|
:prop="column.key"
|
|
:prop="column.key"
|
|
:label="column.title"
|
|
:label="column.title"
|
|
- :width="column.width || 180"
|
|
|
|
- :show-overflow-tooltip="column.showOverflowTooltip || true"
|
|
|
|
|
|
+ :width="column.width || 200"
|
|
|
|
+ show-overflow-tooltip
|
|
>
|
|
>
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <dict-tag
|
|
|
|
+ v-if="column.inputType === 'Select'"
|
|
|
|
+ :size="size"
|
|
|
|
+ :value="scope.row[column.key]"
|
|
|
|
+ :options="dict.type[column.referName]"
|
|
|
|
+ />
|
|
|
|
+ <dr-file-preview
|
|
|
|
+ v-else-if="column.inputType === 'Upload'"
|
|
|
|
+ v-model="scope.row[column.key]"
|
|
|
|
+ ></dr-file-preview>
|
|
|
|
+ <span v-else>{{ scope.row[column.key] }}</span>
|
|
|
|
+ </template>
|
|
</el-table-column>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-table>
|
|
<pagination
|
|
<pagination
|