|
|
@@ -7,6 +7,7 @@
|
|
|
top="10vh"
|
|
|
append-to-body
|
|
|
@close="closed"
|
|
|
+ @opened="opened"
|
|
|
>
|
|
|
<div class="el-dialog-div">
|
|
|
<g-search-table
|
|
|
@@ -28,10 +29,11 @@
|
|
|
v-model="search.key"
|
|
|
maxlength="50"
|
|
|
placeholder="请输入检查项或检查内容"
|
|
|
+ @changed="onKeyChanged"
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
- <el-form-item prop="ruleId" label="检查手册">
|
|
|
- <el-select v-model="search.ruleId">
|
|
|
+ <el-form-item prop="selectRuleId" label="检查手册">
|
|
|
+ <el-select v-model="selectRuleId" clearable @change="onRuleChanged">
|
|
|
<el-option
|
|
|
v-for="item in ruleList"
|
|
|
:value="item.id"
|
|
|
@@ -39,7 +41,7 @@
|
|
|
:label="item.name"
|
|
|
></el-option>
|
|
|
</el-select>
|
|
|
- </el-form-item>
|
|
|
+ </el-form-item>
|
|
|
</template>
|
|
|
|
|
|
<!-- 表格 -->
|
|
|
@@ -90,61 +92,59 @@ export default {
|
|
|
isShow: false,
|
|
|
selectList: [],
|
|
|
ruleList: [],
|
|
|
+ selectRuleId: null,
|
|
|
search: this.emptySearch(),
|
|
|
prevOrgType: [],
|
|
|
};
|
|
|
},
|
|
|
computed: {},
|
|
|
- watch: {
|
|
|
- search: {
|
|
|
- deep: true,
|
|
|
- handler(v) {
|
|
|
- if (v.ruleId) {
|
|
|
- this.$refs.st.search();
|
|
|
- }
|
|
|
- },
|
|
|
- },
|
|
|
- },
|
|
|
+ watch: {},
|
|
|
props: {
|
|
|
- // defaultSelect:{
|
|
|
- // type:Array
|
|
|
- // },
|
|
|
orgType: {
|
|
|
type: Array,
|
|
|
- isRequired:true,
|
|
|
+ isRequired: true,
|
|
|
},
|
|
|
},
|
|
|
methods: {
|
|
|
- show(defaultSelect) {
|
|
|
+ show(defaultSelect) {
|
|
|
this.isShow = true;
|
|
|
if (defaultSelect && defaultSelect.map) {
|
|
|
this.selectList = defaultSelect.map((s) => ({ id: s }));
|
|
|
}
|
|
|
- if (this.prevOrgType.length==this.orgType.length && !this.prevOrgType.find(t=>!this.orgType.includes[t])) {
|
|
|
- this.search.itemName=null;
|
|
|
- if (this.search.ruleId) {
|
|
|
- this.$refs.st.search();
|
|
|
+ },
|
|
|
+ onHide() {
|
|
|
+ this.isShow = false;
|
|
|
+ },
|
|
|
+ opened() {
|
|
|
+ if (
|
|
|
+ this.prevOrgType.length == this.orgType.length &&
|
|
|
+ !this.prevOrgType.find((t) => !this.orgType.includes[t])
|
|
|
+ ) {
|
|
|
+ this.search.itemName = null;
|
|
|
+ if (this.search.ruleId && this.search.ruleId.length > 0) {
|
|
|
+ this.getList();
|
|
|
}
|
|
|
} else {
|
|
|
this.search = this.emptySearch();
|
|
|
ruleListForOrg({ orgType: this.orgType }).then((r) => {
|
|
|
this.ruleList = r.data;
|
|
|
this.prevOrgType = this.orgType;
|
|
|
- if (r.data && r.data.length > 0) {
|
|
|
- this.search.ruleId = r.data[0].id;
|
|
|
- }
|
|
|
+ this.getList();
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
- onHide() {
|
|
|
- this.isShow = false;
|
|
|
- },
|
|
|
closed() {
|
|
|
- this.$refs.st.dataList=[];
|
|
|
+ this.$refs.st.dataList = [];
|
|
|
},
|
|
|
onSelect(item) {
|
|
|
this.selectList = item;
|
|
|
},
|
|
|
+ onKeyChanged() {
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ onRuleChanged() {
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
onSubmit() {
|
|
|
let s = this.selectList;
|
|
|
this.$emit("select", this.selectList);
|
|
|
@@ -152,10 +152,22 @@ export default {
|
|
|
},
|
|
|
emptySearch() {
|
|
|
return {
|
|
|
- ruleId: null,
|
|
|
+ ruleId: [],
|
|
|
itemName: null,
|
|
|
};
|
|
|
},
|
|
|
+ getList() {
|
|
|
+ if (!this.ruleList || this.ruleList.length === 0) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this.selectRuleId) {
|
|
|
+ this.search.ruleId = [this.selectRuleId];
|
|
|
+ } else {
|
|
|
+ this.search.ruleId = this.ruleList.map((r) => r.id);
|
|
|
+ }
|
|
|
+ this.$refs.st.search();
|
|
|
+ },
|
|
|
},
|
|
|
mounted() {},
|
|
|
};
|