From 51123d5ad145745f855280783c01cc2906b693d0 Mon Sep 17 00:00:00 2001 From: su1124 <1583764726@qq.com> Date: 星期三, 24 一月 2024 18:00:20 +0800 Subject: [PATCH] su --- src/views/record/record/index.vue | 654 ++++++++++++++++++++++++++++++++++++---------------------- 1 files changed, 406 insertions(+), 248 deletions(-) diff --git a/src/views/record/record/index.vue b/src/views/record/record/index.vue index 00374fc..9e859a9 100644 --- a/src/views/record/record/index.vue +++ b/src/views/record/record/index.vue @@ -1,38 +1,88 @@ <template> - <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="75px"> - <el-form-item label="浣撴鍙�" prop="tjNum"> - <el-input v-model="queryParams.tjNum" placeholder="璇疯緭鍏ラ椁愪汉浣撴鍙�" clearable @keyup.enter.native="handleQuery" style="width: 200px;" ref="inputName" @blur="handleQuery" /> - </el-form-item> - <el-form-item label="濮撳悕" prop="tjPeopleName"> - <el-input v-model="queryParams.tjPeopleName" placeholder="璇疯緭鍏ラ椁愪汉濮撳悕" clearable style="width: 200px;" - @keyup.enter.native="handleQuery" /> - </el-form-item> - <el-form-item label="鐧昏鏃堕棿" prop="cateringId"> - <el-input v-model="queryParams.cateringId" placeholder="璇疯緭鍏ョ櫥璁版椂闂�" clearable style="width: 200px;" - @keyup.enter.native="handleQuery" /> - </el-form-item> - <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button> - <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button> - </el-form-item> - </el-form><br> + <div class="app-container"> + <el-form + :model="queryParams" + ref="queryForm" + size="small" + :inline="true" + v-show="showSearch" + label-width="75px" + > + <el-form-item label="浣撴鍙�" prop="tjNum"> + <el-input + v-model="queryParams.tjNum" + placeholder="璇疯緭鍏ラ椁愪汉浣撴鍙�" + clearable + @keyup.enter.native="handleQuery" + style="width: 200px" + ref="inputName" + @blur="hb" + /> + </el-form-item> + <el-form-item label="濮撳悕" prop="tjPeopleName"> + <el-input + v-model="queryParams.tjPeopleName" + placeholder="璇疯緭鍏ラ椁愪汉濮撳悕" + clearable + style="width: 200px" + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item label="鐧昏鏃堕棿" prop="cateringId"> + <el-input + v-model="queryParams.cateringId" + placeholder="璇疯緭鍏ョ櫥璁版椂闂�" + clearable + style="width: 200px" + @keyup.enter.native="handleQuery" + /> + </el-form-item> + <el-form-item> + <el-button + type="primary" + icon="el-icon-search" + size="mini" + @click="handleQuery" + >鎼滅储</el-button + > + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery" + >閲嶇疆</el-button + > + </el-form-item> </el-form + ><br /> - <el-form :label-position="labelPosition" :inline="true" label-width="75px" :model="formLabelAlign" - class="demo-form-inline"> - <el-form-item label="閰嶉鍚嶇О" > - <el-input v-model="formLabelAlign.name" style="width: 200px;" placeholder="璇疯緭鍏ラ厤椁愬悕绉�"></el-input> - </el-form-item> - <el-form-item label="濂楅鏄庣粏"> - <el-input v-model="formLabelAlign.region" style="width: 200px;" placeholder="璇疯緭鍏ュ椁愭槑缁�"></el-input> - </el-form-item> - <el-form-item label="钀ュ吇璇存槑" > - <el-input v-model="formLabelAlign.type" style="width: 200px;" placeholder="璇疯緭鍏ヨ惀鍏昏鏄�"></el-input> - </el-form-item> - </el-form> + <el-form + :label-position="labelPosition" + :inline="true" + label-width="75px" + :model="formLabelAlign" + class="demo-form-inline" + > + <el-form-item label="閰嶉鍚嶇О"> + <el-input + v-model="formLabelAlign.name" + style="width: 200px" + placeholder="璇疯緭鍏ラ厤椁愬悕绉�" + ></el-input> + </el-form-item> + <el-form-item label="濂楅鏄庣粏"> + <el-input + v-model="formLabelAlign.region" + style="width: 200px" + placeholder="璇疯緭鍏ュ椁愭槑缁�" + ></el-input> + </el-form-item> + <el-form-item label="钀ュ吇璇存槑"> + <el-input + v-model="formLabelAlign.type" + style="width: 200px" + placeholder="璇疯緭鍏ヨ惀鍏昏鏄�" + ></el-input> + </el-form-item> + </el-form> - <el-row :gutter="10" class="mb8"> - <!-- <el-col :span="1.5"> + <el-row :gutter="10" class="mb8"> + <!-- <el-col :span="1.5"> <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['record:record:add']">鏂板 </el-button> @@ -42,238 +92,346 @@ v-hasPermi="['record:record:edit']">淇敼 </el-button> </el-col> --> - <el-col :span="1.5"> - <el-button type="primary" icon="el-icon-plus" size="mini" :disabled="multiple" @click="handleDelete" - v-hasPermi="['record:record:remove']">棰嗛 - </el-button> - </el-col> - <el-col :span="1.5"> - <el-button type="primary" icon="el-icon-download" size="mini" @click="handleExport" - v-hasPermi="['record:record:export']">瀵煎嚭 - </el-button> - </el-col> - <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> - </el-row> + <el-col :span="1.5"> + <el-button + type="primary" + icon="el-icon-plus" + size="mini" + :disabled="multiple" + @click="handleDelete" + v-hasPermi="['record:record:remove']" + >棰嗛 + </el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="primary" + icon="el-icon-download" + size="mini" + @click="handleExport" + v-hasPermi="['record:record:export']" + >瀵煎嚭 + </el-button> + </el-col> + <right-toolbar + :showSearch.sync="showSearch" + @queryTable="getList" + ></right-toolbar> + </el-row> - + <el-table + v-loading="loading" + :data="recordList" + @selection-change="handleSelectionChange" + border + > + <el-table-column type="selection" width="55" align="center" /> + <!-- <el-table-column label="${comment}" align="center" prop="id"/> --> + <el-table-column label="搴忓彿" align="center" prop="newID" width="55px" /> + <el-table-column + label="棰嗛浜轰綋妫�鍙�" + align="center" + prop="tjNum" + :show-overflow-tooltip="true" + /> + <el-table-column + label="棰嗛浜哄鍚�" + align="center" + prop="tjPeopleName" + :show-overflow-tooltip="true" + /> + <el-table-column + label="鎬у埆" + align="center" + prop="cateringId" + :show-overflow-tooltip="true" + /> + <el-table-column + label="骞撮緞" + align="center" + prop="cateringId" + :show-overflow-tooltip="true" + /> + <el-table-column + label="鐢佃瘽" + align="center" + prop="cateringId" + :show-overflow-tooltip="true" + /> + <el-table-column + label="鍥綋/涓汉" + align="center" + prop="cateringId" + :show-overflow-tooltip="true" + /> + <el-table-column + label="鎵�閫夊椁�" + align="center" + prop="cateringId" + :show-overflow-tooltip="true" + /> + <el-table-column + label="鐧昏鏃堕棿" + align="center" + prop="cateringId" + :show-overflow-tooltip="true" + /> + <el-table-column + label="閰嶉鍚嶇О" + align="center" + prop="cateringId" + :show-overflow-tooltip="true" + /> + <el-table-column + label="鎶ュ憡鏃堕棿" + align="center" + prop="cateringId" + :show-overflow-tooltip="true" + /> + <el-table-column + label="鎿嶄綔" + align="center" + class-name="small-padding fixed-width" + width="80px" + > + <template slot-scope="scope"> + <el-button + size="mini" + type="text" + icon="el-icon-edit" + @click="handleUpdate(scope.row)" + v-hasPermi="['record:record:edit']" + title="淇敼" + > + </el-button> + <el-button + size="mini" + type="text" + icon="el-icon-delete" + @click="handleDelete(scope.row)" + v-hasPermi="['record:record:remove']" + title="鍒犻櫎" + > + </el-button> + </template> + </el-table-column> + </el-table> - <el-table v-loading="loading" :data="recordList" @selection-change="handleSelectionChange" border> - <el-table-column type="selection" width="55" align="center" /> - <!-- <el-table-column label="${comment}" align="center" prop="id"/> --> - <el-table-column label="搴忓彿" align="center" prop="newID" width="55px" /> - <el-table-column label="棰嗛浜轰綋妫�鍙�" align="center" prop="tjNum" :show-overflow-tooltip="true" /> - <el-table-column label="棰嗛浜哄鍚�" align="center" prop="tjPeopleName" :show-overflow-tooltip="true" /> - <el-table-column label="鎬у埆" align="center" prop="cateringId" :show-overflow-tooltip="true" /> - <el-table-column label="骞撮緞" align="center" prop="cateringId" :show-overflow-tooltip="true" /> - <el-table-column label="鐢佃瘽" align="center" prop="cateringId" :show-overflow-tooltip="true" /> - <el-table-column label="鍥綋/涓汉" align="center" prop="cateringId" :show-overflow-tooltip="true" /> - <el-table-column label="鎵�閫夊椁�" align="center" prop="cateringId" :show-overflow-tooltip="true" /> - <el-table-column label="鐧昏鏃堕棿" align="center" prop="cateringId" :show-overflow-tooltip="true" /> - <el-table-column label="閰嶉鍚嶇О" align="center" prop="cateringId" :show-overflow-tooltip="true" /> - <el-table-column label="鎶ュ憡鏃堕棿" align="center" prop="cateringId" :show-overflow-tooltip="true" /> - <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width" width="80px"> - <template slot-scope="scope"> - <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" - v-hasPermi="['record:record:edit']" title="淇敼"> - </el-button> - <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" - v-hasPermi="['record:record:remove']" title="鍒犻櫎"> - </el-button> - </template> - </el-table-column> - </el-table> + <pagination + v-show="total > 0" + :total="total" + :page.sync="queryParams.pageNum" + :limit.sync="queryParams.pageSize" + @pagination="getList" + /> - <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" - @pagination="getList" /> - - <!-- 娣诲姞鎴栦慨鏀归椁愯褰曞璇濇 --> - <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> - <el-form ref="form" :model="form" :rules="rules" label-width="80px"> - <el-form-item label="棰嗛浜轰綋妫�鍙�" prop="tjNum"> - <el-input v-model="form.tjNum" placeholder="璇疯緭鍏ラ椁愪汉浣撴鍙�" /> - </el-form-item> - <el-form-item label="棰嗛浜哄鍚�" prop="tjPeopleName"> - <el-input v-model="form.tjPeopleName" placeholder="璇疯緭鍏ラ椁愪汉濮撳悕" /> - </el-form-item> - <el-form-item label="${comment}" prop="cateringId"> - <el-input v-model="form.cateringId" placeholder="璇疯緭鍏�${comment}" /> - </el-form-item> - </el-form> - <div slot="footer" class="dialog-footer"> - <el-button type="primary" @click="submitForm">纭� 瀹�</el-button> - <el-button @click="cancel">鍙� 娑�</el-button> - </div> - </el-dialog> - </div> + <!-- 娣诲姞鎴栦慨鏀归椁愯褰曞璇濇 --> + <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> + <el-form ref="form" :model="form" :rules="rules" label-width="80px"> + <el-form-item label="棰嗛浜轰綋妫�鍙�" prop="tjNum"> + <el-input v-model="form.tjNum" placeholder="璇疯緭鍏ラ椁愪汉浣撴鍙�" /> + </el-form-item> + <el-form-item label="棰嗛浜哄鍚�" prop="tjPeopleName"> + <el-input + v-model="form.tjPeopleName" + placeholder="璇疯緭鍏ラ椁愪汉濮撳悕" + /> + </el-form-item> + <el-form-item label="${comment}" prop="cateringId"> + <el-input v-model="form.cateringId" placeholder="璇疯緭鍏�${comment}" /> + </el-form-item> + </el-form> + <div slot="footer" class="dialog-footer"> + <el-button type="primary" @click="submitForm">纭� 瀹�</el-button> + <el-button @click="cancel">鍙� 娑�</el-button> + </div> + </el-dialog> + </div> </template> <script> import { - listRecord, - getRecord, - delRecord, - addRecord, - updateRecord + listRecord, + getRecord, + delRecord, + addRecord, + updateRecord, } from "@/api/record/record"; export default { - name: "Record", - data() { - return { - formLabelAlign: { - name: '', - region: '', - type: '' - }, - labelPosition: "right", - // 閬僵灞� - loading: true, - // 閫変腑鏁扮粍 - ids: [], - // 闈炲崟涓鐢� - single: true, - // 闈炲涓鐢� - multiple: true, - // 鏄剧ず鎼滅储鏉′欢 - showSearch: true, - // 鎬绘潯鏁� - total: 0, - // 棰嗛璁板綍琛ㄦ牸鏁版嵁 - recordList: [], - // 寮瑰嚭灞傛爣棰� - title: "", - // 鏄惁鏄剧ず寮瑰嚭灞� - open: false, - // 鏌ヨ鍙傛暟 - queryParams: { - pageNum: 1, - pageSize: 10, - tjNum: null, - tjPeopleName: null, - cateringId: new Date(new Date().getTime() + 8 * 3600 * 1000).toJSON().substr(0, 19).replace('T', ' '), - }, - // 琛ㄥ崟鍙傛暟 - form: {}, - // 琛ㄥ崟鏍¢獙 - rules: { - } - }; - }, - created() { - this.getList(); - }, - mounted() { + name: "Record", + data() { + return { + formLabelAlign: { + name: "", + region: "", + type: "", + }, + labelPosition: "right", + // 閬僵灞� + loading: true, + // 閫変腑鏁扮粍 + ids: [], + // 闈炲崟涓鐢� + single: true, + // 闈炲涓鐢� + multiple: true, + // 鏄剧ず鎼滅储鏉′欢 + showSearch: true, + // 鎬绘潯鏁� + total: 0, + // 棰嗛璁板綍琛ㄦ牸鏁版嵁 + recordList: [], + // 寮瑰嚭灞傛爣棰� + title: "", + // 鏄惁鏄剧ず寮瑰嚭灞� + open: false, + // 鏌ヨ鍙傛暟 + queryParams: { + pageNum: 1, + pageSize: 10, + tjNum: null, + tjPeopleName: null, + cateringId: new Date(new Date().getTime() + 8 * 3600 * 1000) + .toJSON() + .substr(0, 19) + .replace("T", " "), + }, + // 琛ㄥ崟鍙傛暟 + form: {}, + // 琛ㄥ崟鏍¢獙 + rules: {}, + }; + }, + created() { + this.getList(); + }, + mounted() { this.$nextTick(() => { this.$refs.inputName.focus(); }); }, - methods: { - /** 鏌ヨ棰嗛璁板綍鍒楄〃 */ - getList() { - this.loading = true; - listRecord(this.queryParams).then(response => { - this.recordList = response.rows; - response.rows.forEach((item,index) => { - item.newID=(this.queryParams.pageNum-1)*this.queryParams.pageSize+index+1 + methods: { + /** 鏌ヨ棰嗛璁板綍鍒楄〃 */ + getList() { + this.loading = true; + listRecord(this.queryParams).then((response) => { + this.recordList = response.rows; + response.rows.forEach((item, index) => { + item.newID = + (this.queryParams.pageNum - 1) * this.queryParams.pageSize + + index + + 1; }); - this.total = response.total; - this.loading = false; + this.total = response.total; + this.loading = false; + }); + }, + // 鍙栨秷鎸夐挳 + cancel() { + this.open = false; + this.reset(); + }, + // 琛ㄥ崟閲嶇疆 + reset() { + this.form = { + id: null, + tjNum: null, + tjPeopleName: null, + cateringId: null, + createBy: null, + createTime: null, + updateBy: null, + updateTime: null, + deleted: null, + }; + this.resetForm("form"); + }, + hb() { + if (this.queryParams.tjNum != null) { + this.handleQuery(); + } + }, + /** 鎼滅储鎸夐挳鎿嶄綔 */ + handleQuery() { + this.queryParams.pageNum = 1; + this.getList(); + }, + /** 閲嶇疆鎸夐挳鎿嶄綔 */ + resetQuery() { + this.resetForm("queryForm"); + this.handleQuery(); + }, + // 澶氶�夋閫変腑鏁版嵁 + handleSelectionChange(selection) { + this.ids = selection.map((item) => item.id); + this.single = selection.length !== 1; + this.multiple = !selection.length; + }, + /** 鏂板鎸夐挳鎿嶄綔 */ + handleAdd() { + this.reset(); + this.open = true; + this.title = "娣诲姞棰嗛璁板綍"; + }, + /** 淇敼鎸夐挳鎿嶄綔 */ + handleUpdate(row) { + this.reset(); + const id = row.id || this.ids; + getRecord(id).then((response) => { + this.form = response.data; + this.open = true; + this.title = "淇敼棰嗛璁板綍"; + }); + }, + /** 鎻愪氦鎸夐挳 */ + submitForm() { + this.$refs["form"].validate((valid) => { + if (valid) { + if (this.form.reId != null) { + updateRecord(this.form).then((response) => { + this.$modal.msgSuccess("淇敼鎴愬姛"); + this.open = false; + this.getList(); }); - }, - // 鍙栨秷鎸夐挳 - cancel() { - this.open = false; - this.reset(); - }, - // 琛ㄥ崟閲嶇疆 - reset() { - this.form = { - id: null, - tjNum: null, - tjPeopleName: null, - cateringId: null, - createBy: null, - createTime: null, - updateBy: null, - updateTime: null, - deleted: null - }; - this.resetForm("form"); - }, - /** 鎼滅储鎸夐挳鎿嶄綔 */ - handleQuery() { - this.queryParams.pageNum = 1; - this.getList(); - }, - /** 閲嶇疆鎸夐挳鎿嶄綔 */ - resetQuery() { - this.resetForm("queryForm"); - this.handleQuery(); - }, - // 澶氶�夋閫変腑鏁版嵁 - handleSelectionChange(selection) { - this.ids = selection.map(item => item.id) - this.single = selection.length !== 1 - this.multiple = !selection.length - }, - /** 鏂板鎸夐挳鎿嶄綔 */ - handleAdd() { - this.reset(); - this.open = true; - this.title = "娣诲姞棰嗛璁板綍"; - }, - /** 淇敼鎸夐挳鎿嶄綔 */ - handleUpdate(row) { - this.reset(); - const id = row.id || this.ids - getRecord(id).then(response => { - this.form = response.data; - this.open = true; - this.title = "淇敼棰嗛璁板綍"; + } else { + addRecord(this.form).then((response) => { + this.$modal.msgSuccess("鏂板鎴愬姛"); + this.open = false; + this.getList(); }); - }, - /** 鎻愪氦鎸夐挳 */ - submitForm() { - this.$refs["form"].validate(valid => { - if (valid) { - if (this.form.reId != null) { - updateRecord(this.form).then(response => { - this.$modal.msgSuccess("淇敼鎴愬姛"); - this.open = false; - this.getList(); - }); - } else { - addRecord(this.form).then(response => { - this.$modal.msgSuccess("鏂板鎴愬姛"); - this.open = false; - this.getList(); - }); - } - } - }); - }, - /** 鍒犻櫎鎸夐挳鎿嶄綔 */ - handleDelete(row) { - const reIds = row.reId || this.ids; - this.$modal.confirm('鏄惁纭鍒犻櫎缂栧彿涓�"' + reIds + '"鐨勬暟鎹」锛�').then(function () { - return delRecord(reIds); - }).then(() => { - this.getList(); - this.$modal.msgSuccess("鍒犻櫎鎴愬姛"); - }).catch(() => { }); - }, - /** 澶嶉�夋閫変腑鏁版嵁 */ - handleDmKsSelectionChange(selection) { - this.checkedDmKs = selection.map(item => item.index) + } } - , - /** 瀵煎嚭鎸夐挳鎿嶄綔 */ - handleExport() { - this.download('${moduleName}/${businessName}/export', { - ...this.queryParams - }, `${businessName}_#[[${new Date().getTime()}.xlsx`) - } - } -} - ; + }); + }, + /** 鍒犻櫎鎸夐挳鎿嶄綔 */ + handleDelete(row) { + const reIds = row.reId || this.ids; + this.$modal + .confirm('鏄惁纭鍒犻櫎缂栧彿涓�"' + reIds + '"鐨勬暟鎹」锛�') + .then(function () { + return delRecord(reIds); + }) + .then(() => { + this.getList(); + this.$modal.msgSuccess("鍒犻櫎鎴愬姛"); + }) + .catch(() => {}); + }, + /** 澶嶉�夋閫変腑鏁版嵁 */ + handleDmKsSelectionChange(selection) { + this.checkedDmKs = selection.map((item) => item.index); + }, + /** 瀵煎嚭鎸夐挳鎿嶄綔 */ + handleExport() { + this.download( + "${moduleName}/${businessName}/export", + { + ...this.queryParams, + }, + `${businessName}_#[[${new Date().getTime()}.xlsx` + ); + }, + }, +}; </script> -- Gitblit v1.8.0