123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293 |
- <template>
-
- <el-dialog
- title="关联清表"
- :visible.sync="GLExcel"
- append-to-body
- destroy-on-close
-
- @close="GLExcelMD"
- width="70%"
- >
- <div>
- <el-select
- style="width: 400px"
- v-model="GLExcelFrom.name"
- placeholder="请选择"
- @change="changetherr()"
- >
- <el-option
- v-for="(item, key) in GLExcelData"
- :key="key"
- :label="item.name"
- :value="item.id"
- >
- </el-option>
- </el-select>
- <el-scrollbar style="margin-top: 20px; height: 50vh">
- <el-input
- style="width: 400px"
- v-model.trim="GLExcelFrom.search"
- placeholder="请输入需要选择的内容"
- ></el-input>
- <el-tree
- :filter-node-method="filterNode222"
- ref="tree"
- class="filter-tree"
- style="margin-top: 10px"
- :props="GLExcelProps"
- :data="exceldata"
- node-key="id"
- accordion
- show-checkbox
- @check="checkchange"
- v-loading="GLExcelLoading"
- >
- </el-tree>
- </el-scrollbar>
- </div>
- <span
- slot="footer"
- class="dialog-footer"
- style="display: flex; justify-content: center; align-items: center"
- >
- <el-button @click="GLExcelMD()">取 消</el-button>
- <el-button
- style="margin-left: 30px"
- type="primary"
- v-throttle="2000"
- @click="saveLinkTab()"
- >确 定</el-button
- >
- </span>
- <!-- 编辑元素 -->
- <el-dialog
- title=" "
- :visible.sync="editElementVisible"
- fullscreen
- append-to-body
- class="full-dialog"
- >
- <EditElement
- :pkeyId="editElementQuery.pkeyId"
- :excelId="editElementQuery.excelId"
- :id="editElementQuery.id"
- :initTableName="editElementQuery.initTableName"
- :pid="editElementQuery.pid"
- :wbsid="editElementQuery.wbsid"
- :nodeid="editElementQuery.nodeid"
- @hideDialog="editElementVisible = false"
- v-if="editElementVisible"
- ></EditElement>
- </el-dialog>
- </el-dialog>
-
- </template>
- <script>
- import {getList,tabLazytreeAll,saveLinkTab, getExcelHtml,} from "@/api/exctab/excelmodel";
- import EditElement from "@/views/manager/projectinfo/editElement/editElement.vue";
- import {findNodeTableByCondition as selectByNodeTable} from "@/api/manager/wbsprivate";
- export default {
- props:{
- GLExcelFrom:Object
- },
- components:{EditElement},
- data(){
- return{
- GLExcel:false,
-
-
-
-
-
-
-
-
- editElementQuery: {
- pkeyId: "",
- excelId: "",
- id: "",
- initTableName: "",
- pid: "",
- wbsid: "",
- nodeid: "",
- },
- exceldata: [],
- GLExcelData: [],
- GLExcelLoading: false,
- editElementVisible: false,
- GLExcelProps: {
- label: "name",
- children: "children",
- disabled: "hasChildren",
- isLeaf: function (data) {
- let tag = false;
- if (!data.hasChildren) {
- tag = true;
- }
- if (data.isExistForm == 1) {
- tag = true;
- }
- return tag;
- },
- },
- }
- },
- watch: {
- "GLExcelFrom.search"(val) {
- console.log(val);
- if (this.exceldata) {
- this.$refs.tree.filter(val);
- }
- },
- },
- methods:{
- show(){
- this.GLExcel=true;
- console.log(this.GLExcel,'GLExcel');
- console.log(this.GLExcelFrom,'GLExcelFrom');
- this.getList({
- current: 1,
- size: 100000,
- parentId: 0,
- });
-
-
-
-
- },
- GLExcelMD() {
-
- this.GLExcelFrom.name = "";
- this.GLExcelFrom.search = "";
- this.GLExcelFrom.id = "";
- this.exceldata = [];
- this.$refs.tree.setCheckedKeys([]);
- this.GLExcel = false;
- },
- async tabLazytreeAll() {
-
- this.GLExcelLoading = true;
- const { data: res } = await tabLazytreeAll({
- modeId: this.GLExcelFrom.name,
- name: this.GLExcelFrom.search,
- });
- this.GLExcelLoading = false;
- console.log(res);
- if (res.code === 200 && res.msg === "操作成功") {
- this.exceldata = res.data;
- }
- },
- changetherr() {
-
- if (this.GLExcelFrom.name != "") {
- this.GLExcelFrom.search = "";
- this.tabLazytreeAll();
- }
- },
-
- async getList(da) {
-
- const { data: res } = await getList(da);
- console.log(res);
- if (res.code === 200 && res.msg === "操作成功") {
- this.GLExcelData = res.data.records;
- }
- },
- filterNode222(value, data) {
- if (!value) return true;
- return data.name.indexOf(value) !== -1;
- },
- checkchange(data) {
-
- if (this.$refs.tree.getCheckedNodes().length === 0) {
- this.$refs.tree.setCheckedKeys([]);
- } else if (this.$refs.tree.getCheckedNodes().length >= 1) {
- this.$refs.tree.setCheckedKeys([data.id]);
- }
- },
- async getExcelHtml2(pkeyId) {
- const { data: res } = await getExcelHtml({ pkeyId });
- console.log(res);
- if (res.code === 200) {
- localStorage.setItem("editElement", res.data);
- }
- },
-
- async rightClick(pkeyId, excelId, id, initTableName) {
- await this.getExcelHtml2(pkeyId);
- this.editElementQuery.pkeyId = pkeyId;
- this.editElementQuery.excelId = excelId;
- this.editElementQuery.id = id;
- this.editElementQuery.initTableName = initTableName;
- this.editElementQuery.pid = this.$route.query.pid;
- this.editElementQuery.wbsid = this.$route.query.wbsid;
-
- this.editElementVisible = true;
- },
- updateNodeTable() {
-
-
-
-
-
-
-
-
-
- },
- async saveLinkTab() {
-
- let checkNodes = this.$refs.tree.getCheckedNodes();
- if (checkNodes.length > 0) {
- let node = checkNodes[checkNodes.length - 1];
- if (node.fileType != 3) {
- this.$message({
- type: "warning",
- message: "请先上传Excel表",
- });
- return;
- }
- console.log(node.id,'node.id');
- console.log(this.GLExcelFrom.id,'this.GLExcelFrom.id');
- const { data: res } = await saveLinkTab({
- exceTabId: node.id,
- tabId: this.GLExcelFrom.id,
- });
- console.log(res);
- if (res.code === 200) {
- this.$message({
- type: "success",
- message: "关联清表成功",
- });
-
-
- this.GLExcel = false;
- this.rightClick(
- this.GLExcelFrom.id,
- this.GLExcelFrom.excelId,
- this.GLExcelFrom.ids,
- this.GLExcelFrom.initTableName
- );
- }
- } else {
- this.$message({
- type: "warning",
- message: "请先设置清表",
- });
- }
- },
-
- }
- }
- </script>
- <style scoped lang="scss">
- .excelBox {
- /deep/.el-dialog__body {
- padding: 20px;
- }
- }
- </style>
|