| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744 |
- <template>
- <basic-container>
- <avue-crud :option="option"
- :table-loading="loading"
- :data="data"
- :page.sync="page"
- :permission="permissionList"
- :before-open="beforeOpen"
- v-model="form"
- ref="crud"
- @row-update="rowUpdate"
- @row-save="rowSave"
- @row-del="rowDel"
- @search-change="searchChange"
- @search-reset="searchReset"
- @selection-change="selectionChange"
- @current-change="currentChange"
- @size-change="sizeChange"
- @refresh-change="refreshChange"
- @on-load="onLoad">
- <template slot="menuLeft">
- <el-button type="danger"
- size="small"
- icon="el-icon-delete"
- plain
- v-if="permission.tellertrunk_delete"
- @click="handleDelete">刪 除
- </el-button>
- <el-button type="primary"
- size="small"
- icon="el-icon-download"
- plain
- v-if="permission.tellertrunk_download"
- @click="handleDownload">下載
- </el-button>
- </template>
- <template slot-scope="{row, index}" slot="menu">
- <el-button size="small" class="el-button--text" v-if="permission.tellertrunk_edit && userInfo.user_id == row.createUser" @click="$refs.crud.rowEdit(row, index)"><i class="el-icon-edit"></i> 編 輯</el-button>
- <el-button size="small" class="el-button--text" v-if="permission.tellertrunk_delete && userInfo.user_id == row.createUser" @click="$refs.crud.rowDel(row, index)"><i class="el-icon-delete"></i> 刪 除</el-button>
- <el-button type="text" icon="el-icon-download" size="small" v-if="permission.tellertrunk_download_file && row.enclosure" @click="fileDownload(row)">附件下載</el-button>
- </template>
- <template slot="enclosureForm" slot-scope="{row}">
- <avue-form ref="form" :option="attachOption" v-model="attachForm" :upload-after="uploadAfter" :upload-error="uploadError" :upload-delete="uploadDelete" :upload-preview="uploadPreview">
- </avue-form>
- </template>
- <template slot="titleForm" slot-scope="{row, index}">
- <div v-html="title" style="white-space: pre-line;color: red;font-weight: bold;"></div>
- </template>
- <template slot="titleLabel" slot-scope="{row, index}">
- <span style="color: red;font-weight: bold;">注意事項:</span>
- </template>
- </avue-crud>
- </basic-container>
- </template>
- <script>
- import {getList, getDetail, add, update, remove, getDownloadList} from "@/api/bank/tellertrunk";
- import {mapGetters} from "vuex";
- import { getCurrentDept } from "@/api/system/dept";
- import {dateFormat} from "../../util/date";
- import SelectDialogUser from "../../components/select-dialog/select-dialog-user";
- import {getDeptTree, getTree} from "@/api/system/dept";
- import {getStandardByCode} from "@/api/bank/handoverstandard";
- import {downloadFileBase64} from "@/util/util";
- export default {
- name: "init-tellertrunk",
- components: {SelectDialogUser},
- data() {
- const validateCheckTime = (rule, value, callback) => {
- if (value === '') {
- callback(new Error('請選擇結束時間'));
- } else if (value < this.form.checkTimeBegin) {
- callback(new Error('結束時間不能早於開始時間!'));
- } else {
- callback();
- }
- };
- return {
- isManageUser: false,
- title: "",
- attachBox: false,
- attachForm: {},
- attachOption: {
- submitBtn: false,
- emptyBtn: false,
- column: [
- {
- // label: '附件上傳',
- prop: 'attachFile',
- type: 'upload',
- drag: true,
- loadText: '模板上傳中,請稍等',
- span: 24,
- fileSize: 5120,
- propsHttp: {
- res: 'data'
- },
- name: "namesrc",
- action: "/api/blade-resource/oss/endpoint/put-file-attach"
- }
- ]
- },
- form: {},
- query: {},
- loading: true,
- page: {
- pageSize: 10,
- currentPage: 1,
- total: 0
- },
- selectionList: [],
- option: {
- addTitle: '新增【櫃員尾箱檢查流水帳記錄表】',
- editTitle: '編輯【櫃員尾箱檢查流水帳記錄表】',
- viewTitle: '查看【櫃員尾箱檢查流水帳記錄表】',
- height:'auto',
- calcHeight: 30,
- tip: false,
- searchShow: true,
- searchMenuSpan: 6,
- border: true,
- index: true,
- viewBtn: true,
- editBtn: false,
- delBtn: false,
- selection: true,
- dialogClickModal: false,
- column: [
- {
- label: '注意事項',
- prop: 'title',
- hide: true,
- formslot: true,
- type: 'text',
- span: 24
- },
- {
- label: "銀行號",
- prop: "bankNo",
- span: 24,
- hide: true,
- disabled: true,
- display: false,
- search: false,
- searchSpan: 4,
- rules: [{
- required: true,
- message: "請輸入銀行號",
- trigger: "blur"
- }]
- },
- {
- label: "機構號",
- prop: "orgNo",
- hide: true,
- disabled: true,
- display: false,
- rules: [{
- required: true,
- message: "請輸入機構號",
- trigger: "blur"
- }]
- },
- {
- label: "機構名稱",
- prop: "orgName",
- span: 24,
- disabled: true,
- rules: [{
- required: true,
- message: "請輸入機構號",
- trigger: "blur"
- }]
- },
- {
- label: "區域/支行",
- prop: "orgNos",
- hide: true,
- display: false,
- searchMultiple: true,
- search: true,
- type: "tree",
- dicData: [],
- props: {
- label: "title",
- value: "key"
- },
- checkStrictly: true,
- rules: [{
- required: true,
- message: "請輸入機構號",
- trigger: "blur"
- }]
- },
- {
- label: "檢查時間",
- prop: "checkTimeRange",
- type: "datetime",
- format: "yyyy-MM-dd HH:mm",
- valueFormat: "yyyy-MM-dd HH:mm",
- searchRange:true,
- hide: true,
- addDisplay: false,
- editDisplay: false,
- viewDisplay: false,
- search: true,
- rules: [{
- required: true,
- message: "請輸入交接日期",
- trigger: "blur"
- }]
- },
- {
- label: "檢查單位",
- prop: "checkUnit",
- type: "select",
- multiple: true,
- dicUrl: "/api/blade-system/dict/dictionary?code=unit_type",
- props:{
- label: "dictValue",
- value: "dictKey",
- },
- dicFormatter: (res) => {
- res.data.forEach(item => {item.disabled = item.isSealed == 1;})
- return res.data;
- },
- change: ({value, column}) => {
- /*if (!value) return;
- let $nameOut = this.findObject(this.option.column, 'checkPersonNameOut');
- $nameOut.display = value != '1';
- let $noOut = this.findObject(this.option.column, 'checkPersonNoOut');
- $noOut.display = value != '1';
- let $name = this.findObject(this.option.column, 'checkPersonName');
- $name.display = value == '1';
- let $no = this.findObject(this.option.column, 'checkPersonNo');
- $no.display = value == '1';
- $no.disabled = value == '1';
- if (!this.form.checkResult) return;*/
- /*let $remark = this.findObject(this.option.column, 'remark');
- if (value == '1' && this.form.checkResult == '1'){
- $remark.rules[0].required = false;
- }else{
- $remark.rules[0].required = true;
- }*/
- },
- rules: [{
- required: true,
- message: "請輸入檢查單位",
- trigger: "blur"
- }]
- },
- {
- label: "檢查內容",
- prop: "checkContent",
- type: "select",
- multiple: true,
- dicUrl: "/api/blade-system/dict/dictionary?code=check_content_tellertrunk",
- props:{
- label: "dictValue",
- value: "dictKey",
- },
- dicFormatter: (res) => {
- res.data.forEach(item => {item.disabled = item.isSealed == 1;})
- return res.data;
- },
- rules: [{
- required: true,
- message: "請輸入檢查內容",
- trigger: "blur"
- }]
- },
- {
- label: "檢查單位",
- prop: "checkUnitSearch",
- type: "select",
- search: true,
- hide: true,
- display: false,
- searchSpan: 4,
- dicUrl: "/api/blade-system/dict/dictionary?code=unit_type",
- props:{
- label: "dictValue",
- value: "dictKey",
- },
- },
- {
- label: "檢查內容",
- prop: "checkContentSearch",
- type: "select",
- search: true,
- searchSpan: 4,
- hide: true,
- display: false,
- dicUrl: "/api/blade-system/dict/dictionary?code=check_content_tellertrunk",
- props:{
- label: "dictValue",
- value: "dictKey",
- },
- },
- {
- label: "檢查時間開始",
- prop: "checkTimeBegin",
- type: "datetime",
- format: "yyyy-MM-dd HH:mm",
- valueFormat: "yyyy-MM-dd HH:mm",
- rules: [{
- required: true,
- message: "請輸入檢查時間開始",
- trigger: "blur"
- }]
- },
- {
- label: "檢查時間結束",
- prop: "checkTimeEnd",
- type: "datetime",
- format: "yyyy-MM-dd HH:mm",
- valueFormat: "yyyy-MM-dd HH:mm",
- rules: [
- {required: true, message: "請輸入檢查時間結束",trigger: "blur"},
- {required: true, validator: validateCheckTime, trigger: 'blur'}
- ]
- },
- {
- label: "本單位持有現金櫃員數量",
- prop: "holdingNumberUnit",
- type: "number",
- rules: [{
- required: true,
- message: "請輸入本單位持有現金櫃員數量",
- trigger: "blur"
- }]
- },
- {
- label: "本次檢查持有現金櫃員數量",
- prop: "holdingNumberCheck",
- type: "number",
- rules: [{
- required: true,
- message: "請輸入本次檢查持有現金櫃員數量",
- trigger: "blur"
- }]
- },
- {
- label: "檢查類型",
- prop: "checkType",
- type: "select",
- multiple: true,
- dicUrl: "/api/blade-system/dict/dictionary?code=check_type",
- props:{
- label: "dictValue",
- value: "dictKey",
- },
- dicFormatter: (res) => {
- res.data.forEach(item => {item.disabled = item.isSealed == 1;})
- return res.data;
- },
- rules: [{
- required: true,
- message: "請輸入檢查類型",
- trigger: "blur"
- }]
- },
- {
- label: "核對結果",
- prop: "checkResult",
- type: "select",
- dicUrl: "/api/blade-system/dict/dictionary?code=check_result",
- props:{
- label: "dictValue",
- value: "dictKey",
- },
- dicFormatter: (res) => {
- res.data.forEach(item => {item.disabled = item.isSealed == 1;})
- return res.data;
- },
- tip: "不能為空值;如選擇〝帳實不符〞需要在備註欄解釋原因",
- change: ({value, column}) => {
- /* if (!this.form.checkUnit || !value) return;
- let $remark = this.findObject(this.option.column, 'remark');
- if (this.form.checkUnit == '1' && value == '1'){
- $remark.rules[0].required = false;
- }else{
- $remark.rules[0].required = true;
- }*/
- },
- rules: [{
- required: true,
- message: "請輸入核對結果",
- trigger: "blur"
- }]
- },
- {
- label: "檢查人員",
- prop: "checkPersonName",
- type: "array",
- dataType: 'string',
- rules: [{
- required: true,
- message: "請輸入檢查人員姓名",
- trigger: "change"
- }]
- },
- {
- label: "檢查人員工號",
- prop: "checkPersonNo",
- type: "array",
- dataType: 'string',
- rules: [{
- required: true,
- message: "請輸入檢查人員(員工號/身份證號後四位)",
- trigger: "blur"
- }]
- },
- {
- label: "備註(可簡要補充檢查發現情況)",
- prop: "remark",
- type: "textarea",
- rules: [{
- required: false,
- message: "請輸入備註(可簡要補充檢查發現情況)",
- trigger: "blur"
- }]
- },
- {
- label: "填報時間",
- prop: "fillingDate",
- addDisplay: false,
- editDisplay: false,
- rules: [{
- required: true,
- message: "請輸入填報時間",
- trigger: "blur"
- }]
- },
- {
- label: "填報人",
- prop: "fillingPerson",
- addDisplay: false,
- editDisplay: false,
- rules: [{
- required: true,
- message: "請輸入填報人",
- trigger: "blur"
- }]
- },
- {
- label: "附件",
- prop: "enclosure",
- formslot: true,
- hide: true,
- rules: [{
- required: false,
- message: "請上傳附件",
- trigger: "blur"
- }]
- },
- {
- label: "更新時間",
- prop: "updateTime",
- addDisplay: false,
- editDisplay: false,
- },
- ]
- },
- data: []
- };
- },
- computed: {
- ...mapGetters(["permission"]),
- ...mapGetters(["userInfo"]),
- permissionList() {
- return {
- addBtn: this.vaildData(this.permission.tellertrunk_add, false),
- viewBtn: this.vaildData(this.permission.tellertrunk_view, false),
- delBtn: this.vaildData(this.permission.tellertrunk_delete, false),
- editBtn: this.vaildData(this.permission.tellertrunk_edit, false)
- };
- },
- ids() {
- let ids = [];
- this.selectionList.forEach(ele => {
- ids.push(ele.id);
- });
- return ids.join(",");
- }
- },
- mounted() {
- getDeptTree().then(res => {
- const column = this.findObject(this.option.column, "orgNos");
- let treeData = getTree(res.data.data, this.userInfo.dept_id);
- column.dicData = treeData;
- });
- getStandardByCode("tellertrunk").then(res => {
- const data = res.data.data;
- if (Object.keys(data).length > 0){
- this.title = data.content;
- }else {
- this.option.column.splice(0,1)
- }
- });
- },
- methods: {
- fileDownload(row){
- downloadFileBase64(row.enclosure, row.enclosureName);
- },
- handleDownload(){
- if (this.selectionList.length === 0) {
- let tip = "確定下載篩選的" + this.page.total + "條數據嗎?"
- this.$confirm(tip, {
- confirmButtonText: "確定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- getDownloadList(this.query).then(res => {
- this.downLoadData(res.data.data, true)
- });
- })
- }else{
- this.downLoadData(this.selectionList, false)
- }
- },
- downLoadData(data, isAll){
- let columns = this.deepClone(this.option.column);
- for (let i = 0; i < columns.length; i++) {
- let item = columns[i];
- if (item.hide || item.prop == 'process'){
- columns.splice(i, 1);
- i--;
- }
- if (!isAll && (item.type == 'select' || item.type == 'tree')){
- item.prop = '$' + item.prop;
- }
- }
- this.$Export.excel({
- title: "櫃員尾箱檢查流水帳記錄表" || new Date().getTime(),
- columns: columns,
- data: data
- });
- },
- uploadPreview(){
- },
- uploadError(error,column){
- this.$message.warning(error + ',不能大於' + column.fileSize + 'KB');
- },
- uploadAfter(res, done, loading, column) {
- this.attachForm.attachFile = [res];
- this.form.enclosure = res.link;
- this.form.enclosureName = res.originalName;
- this.attachBox = false;
- done(res);
- },
- uploadDelete(column,file) {
- return this.$confirm(`是否確定移除該選項?`).then(() => {
- this.attachForm.attachFile = [];
- this.form.enclosure = '';
- this.form.enclosureName = '';
- return true;
- })
- // return this.$confirm(`是否確定移除該選項?`);
- },
- rowSave(row, done, loading) {
- if ( row.checkUnit instanceof Array) row.checkUnit = row.checkUnit.join();
- if ( row.checkType instanceof Array) row.checkType = row.checkType.join();
- if ( row.checkContent instanceof Array) row.checkContent = row.checkContent.join();
- add(row).then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- done();
- }, error => {
- loading();
- window.console.log(error);
- });
- },
- rowUpdate(row, index, done, loading) {
- if ( row.checkUnit instanceof Array) row.checkUnit = row.checkUnit.join();
- if ( row.checkType instanceof Array) row.checkType = row.checkType.join();
- if ( row.checkContent instanceof Array) row.checkContent = row.checkContent.join();
- update(row).then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- done();
- }, error => {
- loading();
- console.log(error);
- });
- },
- rowDel(row) {
- this.$confirm("確定將選擇數據刪除?", {
- confirmButtonText: "確定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- return remove(row.id);
- })
- .then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- });
- },
- handleDelete() {
- if (this.selectionList.length === 0) {
- this.$message.warning("請選擇至少一條數據");
- return;
- }
- this.$confirm("確定將選擇數據刪除?", {
- confirmButtonText: "確定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- return remove(this.ids);
- })
- .then(() => {
- this.onLoad(this.page);
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.$refs.crud.toggleSelection();
- });
- },
- beforeOpen(done, type) {
- this.attachForm = {};
- this.attachOption.column[0].disabled = type == 'view';
- if (type === 'add'){
- let userInfo = localStorage.getItem("saber-userInfo");
- this.form.number = 1;
- this.form.handoverDate = dateFormat(new Date(), "yyyy-MM-dd hh:mm");
- getCurrentDept().then(res => {
- const data = res.data.data;
- this.form.bankNo = data.bankNo;
- this.form.orgNo = data.orgNo;
- this.form.orgName = data.deptName;
- });
- }
- if (["edit", "view"].includes(type)) {
- getDetail(this.form.id).then(res => {
- // this.form = res.data.data;
- const data = res.data.data;
- if (data.enclosureName){
- data.name = data.enclosureName;
- this.attachForm.attachFile = [
- {label: data.name, value: data.originalName}
- ];
- }
- this.form = data;
- });
- }
- done();
- },
- searchReset() {
- this.query = {};
- this.onLoad(this.page);
- },
- searchChange(params, done) {
- if (params.checkUnitSearch){
- params.checkUnit = params.checkUnitSearch;
- }
- if (params.checkContentSearch){
- params.checkContent = params.checkContentSearch;
- }
- if (params.orgNos){
- params.orgNostr = params.orgNos.join();
- params.orgNos = '';
- }
- if (params.checkTimeRange){
- params.checkTime_begin = params.checkTimeRange[0], params.checkTime_end = params.checkTimeRange[1];
- params.checkTimeRange = null;
- }
- this.query = params;
- this.page.currentPage = 1;
- this.onLoad(this.page, params);
- done();
- },
- selectionChange(list) {
- this.selectionList = list;
- },
- selectionClear() {
- this.selectionList = [];
- this.$refs.crud.toggleSelection();
- },
- currentChange(currentPage){
- this.page.currentPage = currentPage;
- },
- sizeChange(pageSize){
- this.page.pageSize = pageSize;
- },
- refreshChange() {
- this.onLoad(this.page, this.query);
- },
- onLoad(page, params = {}) {
- this.loading = true;
- params.createUser = this.userInfo.user_id;
- getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
- const data = res.data.data;
- this.page.total = data.total;
- data.records.forEach(item => {
- item.checkType = item.checkType.split(',');
- item.checkContent = item.checkContent.split(',');
- item.checkUnit = item.checkUnit.split(',');
- })
- this.data = data.records;
- this.loading = false;
- this.selectionClear();
- });
- }
- }
- };
- </script>
- <style scoped>
- >>>.el-form-item__content{
- margin-left: 10px !important;
- }
- </style>
|