From bf84c0c12256cba74419975af58990c59ba418c1 Mon Sep 17 00:00:00 2001 From: sedmedgh Date: Thu, 23 Jun 2022 17:15:17 +0430 Subject: [PATCH] seperate personel components 1401-04-02 --- src/views/personel/components/contracts.vue | 556 ++++++++ src/views/personel/components/estimate.vue | 129 ++ .../personel/components/printContent.vue | 253 ++++ src/views/personel/components/training.vue | 193 +++ src/views/personel/components/writ.vue | 185 +++ src/views/personel/view_edit_personel.vue | 1158 +++++++++-------- 6 files changed, 1926 insertions(+), 548 deletions(-) create mode 100644 src/views/personel/components/contracts.vue create mode 100644 src/views/personel/components/estimate.vue create mode 100644 src/views/personel/components/printContent.vue create mode 100644 src/views/personel/components/training.vue create mode 100644 src/views/personel/components/writ.vue diff --git a/src/views/personel/components/contracts.vue b/src/views/personel/components/contracts.vue new file mode 100644 index 0000000..7435e00 --- /dev/null +++ b/src/views/personel/components/contracts.vue @@ -0,0 +1,556 @@ + + + + \ No newline at end of file diff --git a/src/views/personel/components/estimate.vue b/src/views/personel/components/estimate.vue new file mode 100644 index 0000000..52d98c4 --- /dev/null +++ b/src/views/personel/components/estimate.vue @@ -0,0 +1,129 @@ + + + + + \ No newline at end of file diff --git a/src/views/personel/components/printContent.vue b/src/views/personel/components/printContent.vue new file mode 100644 index 0000000..b1840f1 --- /dev/null +++ b/src/views/personel/components/printContent.vue @@ -0,0 +1,253 @@ + + + + + \ No newline at end of file diff --git a/src/views/personel/components/training.vue b/src/views/personel/components/training.vue new file mode 100644 index 0000000..08ec324 --- /dev/null +++ b/src/views/personel/components/training.vue @@ -0,0 +1,193 @@ + + + + + \ No newline at end of file diff --git a/src/views/personel/components/writ.vue b/src/views/personel/components/writ.vue new file mode 100644 index 0000000..54da76c --- /dev/null +++ b/src/views/personel/components/writ.vue @@ -0,0 +1,185 @@ + + + + + \ No newline at end of file diff --git a/src/views/personel/view_edit_personel.vue b/src/views/personel/view_edit_personel.vue index 3598e2d..b5091c0 100644 --- a/src/views/personel/view_edit_personel.vue +++ b/src/views/personel/view_edit_personel.vue @@ -1,6 +1,6 @@ @@ -1286,8 +1310,12 @@ import axios from "@/axios"; import VuePersianDatetimePicker from 'vue-persian-datetime-picker' import themeConfig from '@/../themeConfig.js' import SingleUploadInput from '@/components/SingleUploadInput' -import {printWindow, setKeyEvent, removeKeyEvent} from "@/mixin/keyEvent"; -import * as TableCol from "../proposal/proposalTbl"; +import {printWindow} from "@/mixin/keyEvent"; +import contracts from "./components/contracts"; +import training from "./components/training"; +import printContent from "./components/printContent"; +import estimate from "./components/estimate"; +import writ from "./components/writ"; function getBase64(file) { return new Promise((resolve, reject) => { @@ -1302,7 +1330,12 @@ function getBase64(file) { export default { components: { SingleUploadInput, - datePicker: VuePersianDatetimePicker + datePicker: VuePersianDatetimePicker, + contracts, + training, + printContent, + estimate, + writ, }, data() { return { @@ -1318,19 +1351,45 @@ export default { loading: false, imageUrl: '', previewVisible: false, - /*previewVisible: false,*/ previewImage: '', - category: [], showLoading: false, - showTermination: false, + fromPersonel: this.$form.createForm(this, {name: 'cordinate'}), frm1: this.$form.createForm(this, {name: 'cordinate'}), form: this.$form.createForm(this, {name: 'cordinate'}), - fromPersonel: this.$form.createForm(this, {name: 'cordinate'}), - fromPerformance: this.$form.createForm(this, {name: 'cordinate'}), - fromEducationalInformation: this.$form.createForm(this, {name: 'cordinate'}), - fromDocs: this.$form.createForm(this, {name: 'cordinate'}), - fromContract: this.$form.createForm(this, {name: 'cordinate'}), - formTermination: this.$form.createForm(this, {name: 'cordinate'}), + personel: {}, + personelBirthDate: null, + estimate: [], + writ: [], + training: [], + image_data: null, + personalDetails: {}, + grade: {}, + contract: [], + updateKey: 0, + + + /*previewVisible: false,*/ + // showTermination: false, + // fromPerformance: this.$form.createForm(this, {name: 'cordinate'}), + // fromDocs: this.$form.createForm(this, {name: 'cordinate'}), + // date_termination: null, + // showAddPerformance: false, + // showAddDocument: false, + // isAlertUpload: false, + // isShowDocs: false, + + //training + // showAddEducationalInformation: false, + // fromEducationalInformation: this.$form.createForm(this, {name: 'cordinate'}), + // category: [], + //training + + + + // contract + // formTermination: this.$form.createForm(this, {name: 'cordinate'}), + // isAlertUploadContract: false, + /*fromContract: this.$form.createForm(this, {name: 'cordinate'}), contractModel: { start_at: '', end_at: '', @@ -1341,38 +1400,24 @@ export default { right_guardianship: 0, reason_termination: '' }, - date_termination: null, - showAddEducationalInformation: false, - showAddContract: false, - showAddPerformance: false, - showAddDocument: false, - personel: {}, - personelBirthDate: null, - estimate: [], - writ: [], - training: [], - contract: [], - isAlertUpload: false, - isAlertUploadContract: false, - isShowDocs: false, - image_data: null, - personalDetails: {}, - activeContract: null, + */ + /*activeContract: null, contractId: '', contractNumber: '', - contractType: "1", showContractPrint: false, //profile_file:null, // editing mode add editContractFlag: false, + showAddContract: false, // editingContractIndex : undefined, contractTypes: undefined, - work_units: [], - showName: false, - contractFileList: [], - grade: {}, + contractType: "1",*/ + // work_units: [], + // showName: false, + // contractFileList: [], + // contract printWindow, } @@ -1384,20 +1429,8 @@ export default { setGender(event) { this.flags.gender = event.target.value }, - printContract(event, id) { - window.open(`http://hr.asco-intl.com:2020/kernel/api/personnel/print?type=${event.key}&id=${id}`, '_blank').focus() - }, - contractFileUpload({fileList, event, file}) { - if (file.response && file.response.id) { - this.image_data = file.response - } - this.contractFileList = fileList; - }, - contractFileRemove() { - this.image_data = null - }, fileUpload({fileList, event, file}) { - if (file.response && file.response.id) { + if (file.status && (file.id || (file.response && file.response.id))) { this.file_ids = fileList.map(x => x.id || x.response.id) } this.prsonalFileList = fileList; @@ -1414,71 +1447,6 @@ export default { } return !this.$getAccess(steps[index]) }, - async detectEditMode(e) { - await this.addContract(e) - if (this.editContractFlag) - this.editContractFlag = false - }, - openEditingContractModal(item, index) { - // console.log(this.contractTypes) - // console.log(item) - item.type = item.type ? item.type.toString() : undefined - if (item.file) { - this.contractFileList = [{uid: item.file.id, name: item.file.filename, status: 'done', url: item.file.storage}] - } - this.activeContract = index - this.editContractFlag = true - this.showAddContract = true - this.contractModel.end_at = item.end_at - this.contractModel.start_at = item.start_at - // console.log("item:::::::::::::",item) - // console.log(item) - this.fromContract.setFieldsValue(item) - - }, - addContract(e) { - e.preventDefault(); - this.fromContract.validateFields((err, values) => { - if (!err) { - if (this.image_data) { - values.contract_file_id = this.image_data.id - } - if (values.work_unit == "new") { - values.work_unit = values.work_unit_name - } - if (this.editContractFlag) { - values.start_at = this.contractModel.start_at - values.end_at = this.contractModel.end_at - this.contract[this.activeContract] = Object.assign(this.contract[this.activeContract], values) - // console.log("model", this.contractModel) - this.contractModel = { - start_at: '', - end_at: '', - salary: 0, - worker_coupon: 0, - housing_allowance: 0, - right_attraction: 0, - right_guardianship: 0, - reason_termination: '' - } - } else { - // console.log("adding") - values.start_at = this.contractModel.start_at - values.end_at = this.contractModel.end_at - this.contract.push(values); - } - // console.log("data", this.contract[this.editingContractIndex]) - this.saveData(); - this.showAddContract = false; - this.$message.success('اطلاعات با موفقیت ثبت شد'); - this.fromContract.resetFields(); - this.image_data = null; - // console.log('contract',this.contract); - } else { - this.$ntGetError('اطلاعات را به صورت کامل وارد کنید'); - } - }); - }, AddJobsHistory() { const obj = { "title": null, @@ -1627,46 +1595,6 @@ export default { }*/ }, - showTerminationModal(index) { - this.activeContract = index; - this.showTermination = true; - }, - addtermination(e) { - e.preventDefault(); - this.formTermination.validateFields(async (err, values) => { - if (!err) { - try { - this.contract[this.activeContract].date_termination = this.date_termination //values.date_termination; - this.contract[this.activeContract].reason_termination = values.reason_termination; - this.showTermination = false; - this.formTermination.resetFields(); - this.saveData(); - } catch (e) { - this.$ntSetError() - - console.log(e) - } finally { - this.$refs.personelTbl.fetch(); - } - } else { - this.$ntGetError('اطلاعات را به صورت کامل وارد کنید'); - } - }); - }, - async removetermination(index) { - try { - this.contract[index].date_termination = null - this.contract[index].datej_termination = null - this.contract[index].reason_termination = null - await this.saveData(); - } catch (e) { - this.$ntSetError() - - console.log(e) - } finally { - await this.getPersonal() - } - }, async saveData() { this.fromPersonel.validateFields(async (err, values) => { if (!err) { @@ -1678,10 +1606,8 @@ export default { //console.log(values); values.id = this.personel.id; //values.profile_file=this.profile_file; - values.contract = this.contract; - values.writ = this.writ; - values.training = this.training - values.estimate = this.estimate + // values.writ = this.writ; + // values.estimate = this.estimate /*values.document=this.documentFileList.map((item)=>{ return item.uid; });*/ @@ -1698,24 +1624,34 @@ export default { values.personel_id = this.personel.personel_id values.profile_file = this.personel.profile_file } - if (!this.$getAccess('personnel.train')) { + + //training + // values.training = this.training + /*if (!this.$getAccess('personnel.train')) { values.training = this.personel.training - } - if (!this.$getAccess('personnel.contract')) { + }*/ + //training + + + // contract + // values.contract = this.contract; + /*if (!this.$getAccess('personnel.contract')) { values.contract = this.personel.contract - } + }*/ + // contract + if (!this.$getAccess('personnel.intro')) { values.intro_checklist = this.personel.intro_checklist } if (!this.$getAccess('personnel.delivery')) { values.equip_checklist = this.personel.equip_checklist } - if (!this.$getAccess('personnel.function')) { + /*if (!this.$getAccess('personnel.function')) { values.estimate = this.personel.estimate - } - if (!this.$getAccess('personnel.rule')) { + }*/ + /*if (!this.$getAccess('personnel.rule')) { values.writ = this.personel.writ - } + }*/ await axios.post('personnel/update', values); this.getdata(this.personel.id); this.$ntSet() @@ -1726,98 +1662,18 @@ export default { } finally { await this.getPersonal() this.$vs.loading.close() - this.showAddPerformance = false + // this.showAddPerformance = false this.showAddDocument = false - this.showAddEducationalInformation = false - this.showAddContract = false - this.showTermination = false - this.showTermination = false + // this.showAddEducationalInformation = false + // this.showAddContract = false + // this.showTermination = false + // this.showTermination = false } } else { this.$ntGetError('اطلاعات را به صورت کامل وارد کنید'); } }); }, - savefromPerformance(e) { - e.preventDefault(); - this.fromPerformance.validateFields((err, values) => { - if (!err) { - this.estimate.push(values); - this.showAddPerformance = false; - this.$message.success('اطلاعات با موفقیت ثبت شد'); - this.fromPerformance.resetFields(); - this.saveData(); - } else { - this.$ntGetError('اطلاعات را به صورت کامل وارد کنید'); - } - }); - }, - async removeContract(item) { - if (item.id) { - try { - await axios.post('/personnel/remove-contract', {id: item.id}); - this.getdata(this.personel.id); - } catch (e) { - - console.log(e); - } - } else { - const index = this.contract.indexOf(item); - this.contract.splice(index, 1); - } - }, - async removeEstimate(item) { - if (item.id) { - try { - await axios.post('/personnel/remove-estimate', {id: item.id}); - await this.getdata(this.personel.id); - } catch (e) { - - console.log(e); - } - } else { - const index = this.estimate.indexOf(item); - this.getdata.splice(index, 1); - } - }, - addDocs(e) { - e.preventDefault(); - this.fromDocs.validateFields((err, values) => { - if (!err) { - if (this.image_data) { - values.file_id = this.image_data.id - values.file = this.image_data.storage - } - this.writ.push(values); - this.showAddDocument = false; - this.$message.success('اطلاعات با موفقیت ثبت شد'); - this.fromDocs.resetFields(); - this.image_data = null; - this.saveData(); - } else { - this.$ntGetError('اطلاعات را به صورت کامل وارد کنید'); - } - }); - }, - addEdu(e) { - e.preventDefault(); - this.fromEducationalInformation.validateFields((err, values) => { - if (!err) { - if (this.image_data) { - values.file_id = this.image_data.id - values.file = this.image_data.storage - } - this.training.push(values); - this.showAddEducationalInformation = false; - this.$message.success('اطلاعات با موفقیت ثبت شد'); - this.fromEducationalInformation.resetFields(); - this.image_data = null; - this.saveData(); - } else { - this.$ntGetError('اطلاعات را به صورت کامل وارد کنید'); - } - }); - }, async savefromPersonel(e) { e.preventDefault(); this.fromPersonel.validateFields(async (err, values) => { @@ -1852,35 +1708,6 @@ export default { } }, - - async removeDocs(item) { - if (item.id) { - try { - await axios.post('/personnel/remove-writ', {id: item.id}); - this.getdata(this.personel.id); - } catch (e) { - console.log(e); - } - } else { - const index = this.writ.indexOf(item); - this.writ.splice(index, 1); - } - }, - - async removeEdu(item) { - if (item.id) { - try { - await axios.post('/personnel/remove-traning', {id: item.id}); - await this.getdata(this.personel.id); - } catch (e) { - console.log(e); - } - } else { - const index = this.training.indexOf(item); - this.getdata.splice(index, 1); - } - }, - async uploadImage(input) { try { let formData = new FormData(); @@ -1970,14 +1797,62 @@ export default { try { const {data} = await axios.get(`/personnel/${this.id}`) await this.showPersonal(data) + this.updateKey++ } catch (e) { console.log(e) } finally { } }, + async getGrad(){ + try { + const {data} = await axios.get('/register/education') + this.grade = data + } catch (e) { + this.$ntSetError() + console.log(e) + } finally { + + } + }, + + //training + /*addEdu(e) { + e.preventDefault(); + this.fromEducationalInformation.validateFields((err, values) => { + if (!err) { + if (this.image_data) { + values.file_id = this.image_data.id + values.file = this.image_data.storage + } + this.training.push(values); + this.showAddEducationalInformation = false; + this.$message.success('اطلاعات با موفقیت ثبت شد'); + this.fromEducationalInformation.resetFields(); + this.image_data = null; + this.saveData(); + } else { + this.$ntGetError('اطلاعات را به صورت کامل وارد کنید'); + } + }); + }, + async removeEdu(item) { + if (item.id) { + try { + await axios.post('/personnel/remove-traning', {id: item.id}); + await this.getdata(this.personel.id); + } catch (e) { + console.log(e); + } + } else { + const index = this.training.indexOf(item); + this.getdata.splice(index, 1); + } + },*/ + //training + //get contract types - async getTypes() { + /*async getTypes() { try { const {data} = await axios.get('/personnel/type/type') this.contractTypes = data @@ -2004,18 +1879,205 @@ export default { if (id == "new") { this.showName = true } + },*/ +/* printContract(event, id) { + window.open(`http://hr.asco-intl.com:2020/kernel/api/personnel/print?type=${event.key}&id=${id}`, '_blank').focus() + },*/ +/* contractFileUpload({fileList, event, file}) { + if (file.response && file.response.id) { + this.image_data = file.response + } + this.contractFileList = fileList; }, - async getGrad(){ + contractFileRemove() { + this.image_data = null + },*/ + /*showTerminationModal(index) { + this.activeContract = index; + this.showTermination = true; + }, + addtermination(e) { + e.preventDefault(); + this.formTermination.validateFields(async (err, values) => { + if (!err) { + try { + this.contract[this.activeContract].date_termination = this.date_termination //values.date_termination; + this.contract[this.activeContract].reason_termination = values.reason_termination; + this.showTermination = false; + this.formTermination.resetFields(); + this.saveData(); + } catch (e) { + this.$ntSetError() + + console.log(e) + } finally { + this.$refs.personelTbl.fetch(); + } + } else { + this.$ntGetError('اطلاعات را به صورت کامل وارد کنید'); + } + }); + }, + async removetermination(index) { try { - const {data} = await axios.get('/register/education') - this.grade = data + this.contract[index].date_termination = null + this.contract[index].datej_termination = null + this.contract[index].reason_termination = null + await this.saveData(); } catch (e) { this.$ntSetError() - console.log(e) - } finally { + console.log(e) + } finally { + await this.getPersonal() } - } + },*/ + /*async removeContract(item) { + if (item.id) { + try { + await axios.post('/personnel/remove-contract', {id: item.id}); + this.getdata(this.personel.id); + } catch (e) { + + console.log(e); + } + } else { + const index = this.contract.indexOf(item); + this.contract.splice(index, 1); + } + },*/ +/* async detectEditMode(e) { + await this.addContract(e) + if (this.editContractFlag) + this.editContractFlag = false + },*/ +/* openEditingContractModal(item, index) { + // console.log(this.contractTypes) + // console.log(item) + item.type = item.type ? item.type.toString() : undefined + if (item.file) { + this.contractFileList = [{uid: item.file.id, name: item.file.filename, status: 'done', url: item.file.storage}] + } + this.activeContract = index + this.editContractFlag = true + this.showAddContract = true + this.contractModel.end_at = item.end_at + this.contractModel.start_at = item.start_at + // console.log("item:::::::::::::",item) + // console.log(item) + this.fromContract.setFieldsValue(item) + + },*/ + /*addContract(e) { + e.preventDefault(); + this.fromContract.validateFields((err, values) => { + if (!err) { + if (this.image_data) { + values.contract_file_id = this.image_data.id + } + if (values.work_unit == "new") { + values.work_unit = values.work_unit_name + } + if (this.editContractFlag) { + values.start_at = this.contractModel.start_at + values.end_at = this.contractModel.end_at + this.contract[this.activeContract] = Object.assign(this.contract[this.activeContract], values) + // console.log("model", this.contractModel) + this.contractModel = { + start_at: '', + end_at: '', + salary: 0, + worker_coupon: 0, + housing_allowance: 0, + right_attraction: 0, + right_guardianship: 0, + reason_termination: '' + } + } else { + // console.log("adding") + values.start_at = this.contractModel.start_at + values.end_at = this.contractModel.end_at + this.contract.push(values); + } + // console.log("data", this.contract[this.editingContractIndex]) + this.saveData(); + this.showAddContract = false; + this.$message.success('اطلاعات با موفقیت ثبت شد'); + this.fromContract.resetFields(); + this.image_data = null; + // console.log('contract',this.contract); + } else { + this.$ntGetError('اطلاعات را به صورت کامل وارد کنید'); + } + }); + },*/ + //contract + + //esetimate + /*savefromPerformance(e) { + e.preventDefault(); + this.fromPerformance.validateFields((err, values) => { + if (!err) { + this.estimate.push(values); + this.showAddPerformance = false; + this.$message.success('اطلاعات با موفقیت ثبت شد'); + this.fromPerformance.resetFields(); + this.saveData(); + } else { + this.$ntGetError('اطلاعات را به صورت کامل وارد کنید'); + } + }); + },*/ + /*async removeEstimate(item) { + if (item.id) { + try { + await axios.post('/personnel/remove-estimate', {id: item.id}); + await this.getdata(this.personel.id); + } catch (e) { + + console.log(e); + } + } else { + const index = this.estimate.indexOf(item); + this.getdata.splice(index, 1); + } + },*/ + //esetimate + + //writ + /* addDocs(e) { + e.preventDefault(); + this.fromDocs.validateFields((err, values) => { + if (!err) { + if (this.image_data) { + values.file_id = this.image_data.id + values.file = this.image_data.storage + } + this.writ.push(values); + this.showAddDocument = false; + this.$message.success('اطلاعات با موفقیت ثبت شد'); + this.fromDocs.resetFields(); + this.image_data = null; + this.saveData(); + } else { + this.$ntGetError('اطلاعات را به صورت کامل وارد کنید'); + } + }); + },*/ + /*async removeDocs(item) { + if (item.id) { + try { + await axios.post('/personnel/remove-writ', {id: item.id}); + this.getdata(this.personel.id); + } catch (e) { + console.log(e); + } + } else { + const index = this.writ.indexOf(item); + this.writ.splice(index, 1); + } + },*/ + //writ }, beforeCreate() { }, @@ -2029,7 +2091,11 @@ export default { }, async created() { await this.getPersonal() - try { + await this.getGrad() + + + + /*try { this.loading = true const {data} = await axios.get('/get-category') this.category = data @@ -2039,17 +2105,13 @@ export default { } finally { this.loading = false - } + }*/ - await this.getTypes() - await this.getUnits() - await this.getGrad() - - setKeyEvent() + // contract + /*await this.getTypes() + await this.getUnits()*/ + // contract }, - beforeDestroy() { - removeKeyEvent() - } }