From 5cdff5e062935666b06848a3b63ae9b32d114146 Mon Sep 17 00:00:00 2001 From: zouyu <2723363702@qq.com> Date: 星期六, 04 十一月 2023 17:35:47 +0800 Subject: [PATCH] Merge branch 'master' of http://114.132.189.42:9002/r/zs-mes-before --- src/views/basic/param/index-bad.vue | 381 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 381 insertions(+), 0 deletions(-) diff --git a/src/views/basic/param/index-bad.vue b/src/views/basic/param/index-bad.vue new file mode 100644 index 0000000..217e2ef --- /dev/null +++ b/src/views/basic/param/index-bad.vue @@ -0,0 +1,381 @@ +<template> + <div class="mod-config"> + <basic-container> + <!-- <ttable + :table="table" + :row-key="id" + :tree-props="{children: 'children', hasChildren: 'hasChildren'}" + @handleSelectionChange="handleSelectionChange" + :uploadInfo="uploadInfo" + :prelang="prelang" + :options="options" + :ajaxFun="ajaxFun" + ref="paramTable" + > + <template #toolbar></template> + </ttable> --> + <el-row style="margin-left: 10px;"> + <el-form :inline="true" :model="table" class="demo-form-inline"> + <el-form-item label="鍙傛暟椤�"> + <el-input v-model="table.param" placeholder="鍙傛暟椤�"></el-input> + </el-form-item> + <el-form-item label="鍙傛暟缂栧彿"> + <el-input v-model="table.code" placeholder="鍙傛暟缂栧彿"></el-input> + </el-form-item> + <el-form-item> + <el-button type="primary" @click="onSearch">鏌ヨ</el-button> + </el-form-item> + </el-form> + </el-row> + <el-row style="margin-left: 10px;height: 80vh;"> + <el-row> + <el-button type="defult" @click="addOrUpdateHandle">鏂板</el-button> + <el-button type="defult" @click="onSearch">瀵煎叆</el-button> + <!-- <el-button type="defult" @click="isExpandAllClick">灞曞紑/鎶樺彔</el-button> --> + </el-row> + <el-row style="padding-top: 20px;"> + <!-- 琛ㄦ牸鏁版嵁鍖�--> + <el-table height="480" style="width: 100%;" :data="table.data" row-key="id" + :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"> + <el-table-column type="index" label="搴忓彿" width="50"> + </el-table-column> + <el-table-column prop="code" label="鍙傛暟缂栧彿"></el-table-column> + <el-table-column prop="parameterItem" label="鍙傛暟椤�"></el-table-column> + <el-table-column prop="type" label="鍙傛暟绫诲瀷"> + <template slot-scope="scope"> + <el-col v-show="scope.row.bianJi===false">{{ scope.row.type }}</el-col> + <el-col v-show="scope.row.bianJi"> + 111 + <!-- <el-select v-model="scope.row.type" filterable placeholder="璇烽�夋嫨鍙傛暟绫诲瀷" style="width:100%" + @change="changeType"> + <el-option v-for="(item, index) in this.typeOptions" :label="item.label" :value="item.value" + :key="item.value"> + </el-option> + </el-select> --> + </el-col> + </template> + </el-table-column> + <el-table-column prop="parameterFormat" label="鍙傛暟鏍煎紡"></el-table-column> + <el-table-column prop="unit" label="鍗曚綅"></el-table-column> + <el-table-column prop="code" label="鎿嶄綔"> + <template slot-scope="scope"> + <el-row style=" display: flex;width: 100%;"> + <el-col><el-button type="text">鍒犻櫎</el-button></el-col> + <el-col v-if="scope.row.isBianji"> + <el-button @click="bianji(scope.row)" type="text">{{ scope.row.bianJiBtn }}</el-button> + </el-col> + </el-row> + </template> + </el-table-column> + </el-table> + <el-row style="display: flex; justify-content: end;"> + <el-pagination :current-page="table.currentPage" @current-change="handlesCurrentChange" + @size-change="sizeChangeHandle" :page-sizes="[10, 20, 50, 100]" :page-size="table.pageSize" + layout="total, sizes, prev, pager, next, jumper" :total="table.total"></el-pagination> + </el-row> + </el-row> + </el-row> + <!-- 寮圭獥, 鏂板 / 淇敼 --> + <table-form v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getData"></table-form> + </basic-container> + </div> +</template> +<script> +import { fetchList, delObj } from '@/api/basic/param' +import TableForm from './param-form' +import ttable from '@/views/common/ztt-table.vue' +import { mapGetters } from 'vuex' +import { remote } from '../../../api/admin/dict' +export default { + data() { + return { + isExpandAll: false, + // 閲嶆柊娓叉煋琛ㄦ牸鐘舵�� + refreshTable: true, + ajaxFun: fetchList, + typeOptions: [], + multipleSelection: [], + isShowQuery: false, + uploadInfo: { + // 鏄惁灞曠ず涓婁紶EXCEL浠ュ強瀵瑰簲鐨剈rl + isShow: true, + url: '/mes/param/upload' + }, + prelang: 'operation', + options: { + height: 300, // 榛樿楂樺害-涓轰簡琛ㄥご鍥哄畾 + stripe: true, // 鏄惁涓烘枒椹汗 table + highlightCurrentRow: false, // 鏄惁瑕侀珮浜綋鍓嶈 + border: true, // 鏄惁鏈夌旱鍚戣竟妗� + lazy: false, // 鏄惁闇�瑕佹噿鍔犺浇 + fit: true, // 鍒楃殑瀹藉害鏄惁鑷拺寮� + multiSelect: false, // + seqNo: true, + isShowHide: true, // 鏄惁鏄剧ず鏄惧奖鎸夐挳 + isSearch: false, // 楂樼骇鏌ヨ鎸夐挳 + defaultOrderBy: { column: 'createTime', direction: 'desc' } + }, + table: { + param: null, + total: 0, + code: null, + currentPage: 1, + pageSize: 20, + data: [], + // 鏍囬 + column: [ + { + minWidth: 'code', + prop: 'code', + label: '鍙傛暟缂栧彿', + sort: true, + isTrue: true, + isSearch: true, + searchInfoType: 'text', + render: { fun: this.addOrUpdateHandle } + }, + { + minWidth: '120', + prop: 'parameterItem', + label: '鍙傛暟椤�', + sort: true, + isTrue: true, + isSearch: true, + searchInfoType: 'text' + }, + { + minWidth: '120', + prop: 'second', + label: '浜岀骇鍙傛暟', + sort: true, + isTrue: true, + isSearch: false, + searchInfoType: 'text' + }, + { + minWidth: '130', + prop: 'third', + label: '涓夌骇鍙傛暟', + sort: true, + isTrue: true, + isSearch: false, + searchInfoType: 'text' + }, + { + minWidth: '140', + prop: 'type', + label: '鍙傛暟绫诲瀷', + sort: true, + isTrue: true, + isSearch: true, + searchInfoType: 'select', + formatter: this.getParam, + optList: () => { + return this.typeOptions + } + }, + { + minWidth: '120', + prop: 'parameterFormat', + label: '鍙傛暟鏍煎紡', + sort: true, + isTrue: true, + isSearch: true, + searchInfoType: 'text' + }, + { + minWidth: '120', + prop: 'unit', + label: '鍗曚綅', + sort: true, + isTrue: true, + isSearch: true, + searchInfoType: 'text' + }, + { + minWidth: '200', + prop: 'createUser', + label: '鍒涘缓浜�', + sort: true, + isTrue: true, + isSearch: true, + searchInfoType: 'text' + }, + { + minWidth: '140', + prop: 'updateUser', + label: '鏇存柊浜�', + sort: true, + isTrue: true, + isSearch: true, + searchInfoType: 'text' + }, + { + minWidth: '120', + prop: 'createTime', + label: '鍒涘缓鏃ユ湡', + sort: true, + isTrue: true, + isSearch: true, + searchInfoType: 'datetimerange' + }, + { + minWidth: '200', + prop: 'updateTime', + label: '鏇存柊鏃ユ湡', + sort: true, + isTrue: true, + isSearch: true, + searchInfoType: 'datetimerange' + } + ], + toolbar: [ + { + text: '鏂板', + type: 'primary', + fun: this.addOrUpdateHandle + } + ], + operator: [ + { + text: '鍒犻櫎', + icon: 'el-icon-delete', + type: 'text', + size: 'small', + fun: this.deleteHandle + } + ], + operatorConfig: { + fixed: 'right', + label: '鎿嶄綔', + width: 100, + minWidth: 100 + } + }, + addOrUpdateVisible: false + } + }, + components: { + ttable, + TableForm + }, + computed: { + ...mapGetters(['permissions']) + }, + created() { + this.getParamType() + this.getData() + }, + methods: { + changeType(){}, + bianji(row){ + // this.$set(row.bianJi,false,true) + row.bianJi=true + row.bianJiBtn='淇濆瓨' + console.log(row) + }, + isExpandAllClick() { + // console.log(1111); + this.isExpandAll = !this.isExpandAll; + this.$nextTick(() => { + this.refreshTable = true; + }); + // console.log(this.isExpandAll); + }, + handlesCurrentChange() { }, + sizeChangeHandle() { }, + onSearch() { }, + // 鑾峰彇鏁版嵁鍒楄〃 + getData() { + let param = { + parentId: 0, + code: this.table.code, + size: this.table.pageSize, + current: this.table.currentPage, + parameterItem: this.table.param + } + fetchList(param).then((res) => { + console.log(res.data); + this.table.total = res.data.data.total + this.table.data = res.data.data.records + let datas=JSON.parse(JSON.stringify(this.table.data)) + datas.forEach(l => { + l.bianJi = false + if (l.children.length < 1) { + l.isBianji = true + l.bianJiBtn='缂栬緫' + } + if (l.children.length > 0) { + l.isBianji = false + l.children.forEach(c => { + c.bianji = false + if (c.children.length < 1) { + c.isBianji = true + c.bianJiBtn='缂栬緫' + } else { + l.isBianji = false + c.children.forEach(cc => { + cc.bianJi = false + cc.isBianji = true + c.bianJiBtn='缂栬緫' + }) + } + }) + } + }) + this.table.data=datas + console.log(this.table.data); + }) + }, + // 鏂板 / 淇敼 + addOrUpdateHandle(row) { + this.addOrUpdateVisible = true + this.$nextTick(() => { + this.$refs.addOrUpdate.init(row == null ? null : row.id) + }) + }, + // 鑾峰彇宸ュ簭鍙傛暟绫诲瀷 + getParamType() { + remote('technology_param').then((response) => { + if (response.data.code === 0) { + this.typeOptions = response.data.data + } + }) + }, + // 閫変腑浠撳簱琛� + handleSelectionChange(val) { + this.multipleSelection = val + }, + // 琛ㄦ牸瀛楁鏍煎紡鍖� + getParam(row, column, cellValue) { + for (let i = 0, len = this.typeOptions.length; i < len; i++) { + if (cellValue == this.typeOptions[i].value) { + return this.typeOptions[i].label + } + } + }, + // 鍒犻櫎 + deleteHandle(row) { + this.$confirm('鏄惁纭鍒犻櫎缂栧彿涓�' + row.code, '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }) + .then(function () { + return delObj(row.id) + }) + .then((data) => { + this.$message.success('鍒犻櫎鎴愬姛') + this.getData() + }) + } + } +} +</script> +<style scoped> +table, +tr, +td { + text-align: center; +} +</style> -- Gitblit v1.9.3