|
@@ -19,17 +19,28 @@ export default {
|
|
|
searchColumns: SearchColumns,
|
|
|
params: initParams(SearchColumns),
|
|
|
tableData: [],
|
|
|
- currentData: [],
|
|
|
+ selectData: [],
|
|
|
tableColumns: FormColumns,
|
|
|
page: { pageNum: 1, pageSize: 10, total: 0 },
|
|
|
};
|
|
|
},
|
|
|
computed: {},
|
|
|
created() {
|
|
|
+ this.params.status = "0";
|
|
|
this.useQuery(this.params, this.page);
|
|
|
},
|
|
|
methods: {
|
|
|
//
|
|
|
+ setSelectable(row) {
|
|
|
+ const { status } = row;
|
|
|
+ // 审批中
|
|
|
+ if (status === "1") return false;
|
|
|
+ // 已完成
|
|
|
+ else if (status === "2") return false;
|
|
|
+ // other
|
|
|
+ else return true;
|
|
|
+ },
|
|
|
+ //
|
|
|
async fetchList(prop, page) {
|
|
|
try {
|
|
|
this.loading = true;
|
|
@@ -54,6 +65,7 @@ export default {
|
|
|
},
|
|
|
// 查 询
|
|
|
useQuery(prop, page) {
|
|
|
+ this.selectData = [];
|
|
|
this.fetchList(prop, page);
|
|
|
},
|
|
|
// 重 置
|
|
@@ -64,7 +76,7 @@ export default {
|
|
|
},
|
|
|
// 选 择
|
|
|
useSelect(prop) {
|
|
|
- this.currentData = [prop];
|
|
|
+ this.selectData = prop;
|
|
|
},
|
|
|
// 新 增
|
|
|
async useAdd() {
|
|
@@ -77,16 +89,23 @@ export default {
|
|
|
const { open } = this.$refs.AddModel;
|
|
|
await open(id);
|
|
|
},
|
|
|
+ hasPowerCopy(prop) {
|
|
|
+ return prop.length === 1;
|
|
|
+ },
|
|
|
// 删 除
|
|
|
async useDelete(prop) {
|
|
|
- const [{ id }] = prop;
|
|
|
const { open } = this.$refs.DeleteModel;
|
|
|
- await open(id);
|
|
|
+ await open(prop);
|
|
|
},
|
|
|
hasPowerDelete(prop) {
|
|
|
- if (!prop.length) return true;
|
|
|
- const [{ status = undefined }] = prop;
|
|
|
- return status === "1" || status === "2";
|
|
|
+ if (prop.length === 1) {
|
|
|
+ const [{ status }] = prop;
|
|
|
+ if (status === "1") return false;
|
|
|
+ else if (status === "2") return false;
|
|
|
+ else return true;
|
|
|
+ } else {
|
|
|
+ return !!prop.length;
|
|
|
+ }
|
|
|
},
|
|
|
// 编 辑
|
|
|
async useEdit(prop) {
|
|
@@ -95,9 +114,14 @@ export default {
|
|
|
await open(id);
|
|
|
},
|
|
|
hasPowerEdit(prop) {
|
|
|
- if (!prop.length) return true;
|
|
|
- const [{ status = undefined }] = prop;
|
|
|
- return status === "1" || status === "2";
|
|
|
+ if (prop.length === 1) {
|
|
|
+ const [{ status }] = prop;
|
|
|
+ if (status === "1") return false;
|
|
|
+ else if (status === "2") return false;
|
|
|
+ else return true;
|
|
|
+ } else {
|
|
|
+ return !!prop.length;
|
|
|
+ }
|
|
|
},
|
|
|
// 明 细
|
|
|
async useSee(prop) {
|
|
@@ -111,9 +135,14 @@ export default {
|
|
|
await open(prop, done);
|
|
|
},
|
|
|
hasPowerSubmit(prop) {
|
|
|
- if (!prop.length) return true;
|
|
|
- const [{ status = undefined }] = prop;
|
|
|
- return status === "1" || status === "2";
|
|
|
+ if (prop.length === 1) {
|
|
|
+ const [{ status }] = prop;
|
|
|
+ if (status === "1") return false;
|
|
|
+ else if (status === "2") return false;
|
|
|
+ else return true;
|
|
|
+ } else {
|
|
|
+ return !!prop.length;
|
|
|
+ }
|
|
|
},
|
|
|
},
|
|
|
};
|
|
@@ -169,6 +198,7 @@ export default {
|
|
|
:clearable="column.clearable"
|
|
|
:placeholder="column.placeholder"
|
|
|
style="width: 100%"
|
|
|
+ @change="useQuery(params, page)"
|
|
|
@keyup.enter.native="useQuery(params, page)"
|
|
|
>
|
|
|
<el-option
|
|
@@ -191,6 +221,7 @@ export default {
|
|
|
:value-key="column.valueKey"
|
|
|
:placeholder="column.placeholder"
|
|
|
:data-mapping="column.dataMapping"
|
|
|
+ @change="useQuery(params, page)"
|
|
|
@keyup.enter.native="useQuery(params, page)"
|
|
|
>
|
|
|
</dr-popover-select>
|
|
@@ -205,16 +236,16 @@ export default {
|
|
|
<el-button :size="size" @click="useReset"> 重 置 </el-button>
|
|
|
<el-button :size="size" @click="useAdd"> 新 增 </el-button>
|
|
|
<el-button
|
|
|
+ v-show="hasPowerCopy(selectData)"
|
|
|
:size="size"
|
|
|
- :disabled="!currentData.length"
|
|
|
- @click="useCopy(currentData)"
|
|
|
+ @click="useCopy(selectData)"
|
|
|
>
|
|
|
复 制
|
|
|
</el-button>
|
|
|
<el-button
|
|
|
- v-if="!hasPowerDelete(currentData)"
|
|
|
+ v-show="hasPowerDelete(selectData)"
|
|
|
:size="size"
|
|
|
- @click="useDelete(currentData)"
|
|
|
+ @click="useDelete(selectData)"
|
|
|
>
|
|
|
删 除
|
|
|
</el-button>
|
|
@@ -223,11 +254,20 @@ export default {
|
|
|
:size="size"
|
|
|
:data="tableData"
|
|
|
highlight-current-row
|
|
|
- @row-click="useSelect"
|
|
|
+ @row-click="useSelect([$event])"
|
|
|
@row-dblclick="useSee"
|
|
|
+ @selection-change="useSelect"
|
|
|
style="width: 100%; margin: 20px 0 0 0"
|
|
|
>
|
|
|
<el-table-column
|
|
|
+ fixed
|
|
|
+ width="55"
|
|
|
+ align="center"
|
|
|
+ type="selection"
|
|
|
+ :selectable="setSelectable"
|
|
|
+ >
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
v-for="(column, index) in tableColumns"
|
|
|
:key="index"
|
|
|
:prop="column.key"
|