123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417 |
- <template>
- <div class="goreport">
- <div class="form gaisideshurukuang">
- <uni-forms
- ref="baseForm"
- style="font-size: 26rpx"
- :modelValue="form"
- label-width="170rpx"
- >
- <uni-forms-item
- label="走访公司"
- class="mt42rpx pd42rpx border_bottom_ccc"
- >
- <div
- @click="chosseAboutCompany()"
- style="height: 73rpx; line-height: 73rpx"
- >
- {{
- !form.companyId
- ? "请选择走访公司"
- : companyAllList[form.companyIndex].label
- }}
- </div>
- </uni-forms-item>
- <uni-forms-item
- label="走访时间:"
- class="mt42rpx pd42rpx border_bottom_ccc"
- >
- <div style="line-height: 73rpx">
- <!-- <picker
- style="float: left; width: 100%; height: 40rpx; color: #777"
- mode="time"
- :value="form.interviewTime"
- @change="getInterviewTime"
- >
- {{ !form.interviewTime ? "请选择走访时间" : form.interviewTime }}
- </picker> -->
- <uni-datetime-picker
- type="datetime"
- v-model="form.interviewTime"
- :border="false"
- />
- </div>
- </uni-forms-item>
- <uni-forms-item
- label="走访类型:"
- class="mt42rpx pd42rpx border_bottom_ccc"
- >
- <div style="height: 73rpx; line-height: 73rpx">
- <picker
- style="float: left; width: 100%; height: 40rpx; color: #777"
- :range="dic_SelectList.interviewType"
- :value="0"
- @change="bindPickerChange"
- range-key="label"
- >
- {{
- !form.interviewType
- ? "请选择"
- : dic_SelectList.interviewType[form.interviewTypeIndex].label
- }}
- </picker>
- </div>
- </uni-forms-item>
- <uni-forms-item
- label="是否需要处理"
- class="mt42rpx pd42rpx border_bottom_ccc"
- >
- <div style="height: 73rpx; line-height: 73rpx">
- <uni-data-checkbox
- v-model="form.isStatus"
- :localdata="range"
- @change="change"
- ></uni-data-checkbox>
- </div>
- </uni-forms-item>
- </uni-forms>
- </div>
- <div class="form" style="margin-bottom: 146rpx">
- <van-row>
- <van-col :span="24"> 走访记录 </van-col>
- <van-col :span="24">
- <div class="margint16rpx">
- <uni-easyinput
- type="textarea"
- inputBorder
- class="textarea_info"
- style="background: #f9f9f9; margin-top: 16rpx"
- v-model="form.interviewRecord"
- placeholder="请输入"
- />
- </div>
- </van-col>
- </van-row>
- </div>
- <van-popup :show="show" bind:close="onClose" round position="bottom">
- <div style="display: flex; justify-content: space-between">
- <div style="margin: 32rpx" @click="show = false">取消</div>
- <div style="margin: 32rpx" @click="getSelectValue()">确认</div>
- </div>
- <uni-easyinput
- v-model="companyName"
- placeholder="请输入内容"
- ></uni-easyinput>
- <picker-view
- indicator-style="height: 50px;"
- style="width: 100%; height: 300px"
- @change="getRowValue"
- :value="value"
- >
- <picker-view-column>
- <view
- v-for="item in filtedCompanyAllList"
- style="line-height: 50px; text-align: center"
- >{{ item.label }}</view
- >
- </picker-view-column>
- </picker-view>
- </van-popup>
- <view class="btn-view">
- <button class="btn" @click="takeParamsGoBack(0)">保存</button>
- <button
- class="btn"
- @click="takeParamsGoBack(1)"
- style="margin-left: 10rpx"
- >
- 添加
- </button>
- </view>
- </div>
- </template>
- <script>
- import multipleSelect from "../../subPackages/components/momo-multipleSelect/momo-multipleSelect";
- import {
- getByCodes,
- addInterview,
- getBySaveStatus,
- editInterview,
- getCompanyAll,
- } from "@/js_sdk/http.js";
- import vanRow from "../../../wxcomponents/weapp/dist/row";
- import vanCol from "../../../wxcomponents/weapp/dist/col";
- // import { findYuanQuList } from "@/js_sdk/http.js";
- const form = {
- id: null,
- isStatus: null,
- interviewTime: null,
- interviewType: null,
- interviewTypeIndex: null,
- companyId: null,
- companyIndex: null,
- projectType: "",
- interviewRecord: "",
- associationCompanyString: [],
- };
- export default {
- components: {
- vanRow,
- vanCol,
- multipleSelect,
- },
- data() {
- return {
- companyName: "",
- value: 0,
- isSelectedIndex: null,
- isStatus: 2,
- range: [
- { value: 2, text: "是" },
- { value: 1, text: "否" },
- ],
- defaultSelected: [],
- dic_key: ["interviewType"],
- dic_SelectList: {},
- companyIndex: null,
- companyAllList: [],
- show: false,
- active: 0,
- form: { ...form },
- index: 0,
- };
- },
- computed: {
- filtedCompanyAllList() {
- let companyAllList;
- if (this.companyName) {
- companyAllList = this.companyAllList.filter((e) =>
- e.label.includes(this.companyName)
- );
- } else {
- companyAllList = this.companyAllList;
- }
- return companyAllList;
- },
- },
- mounted() {
- this.getCompanyAll();
- this.getByCodes();
- },
- methods: {
- getRowValue(e) {
- this.isSelectedIndex = e.detail.value[0];
- },
- getSelectValue() {
- if (this.isSelectedIndex == null) {
- this.form.companyIndex = 0;
- this.form.companyId = this.companyAllList[0].value;
- } else {
- this.form.companyIndex = this.isSelectedIndex;
- this.form.companyId = this.companyAllList[this.form.companyIndex].value;
- }
- this.$forceUpdate();
- this.show = false;
- },
- changeLog(e) {},
- async getBySaveStatus() {
- const token = uni.getStorageSync("laocui_user_info");
- let data = await getBySaveStatus(JSON.parse(token).user.id);
- this.form.id = data.id ? data.id : null;
- this.form.isStatus = Number(data.isStatus);
- this.form.interviewTime = data.interviewTime ? data.interviewTime : "";
- this.form.interviewRecord = data.interviewRecord
- ? data.interviewRecord
- : "";
- if (
- data.id &&
- data.interviewType != null &&
- data.interviewType != "null"
- ) {
- this.getInterviewLableByApiList(data);
- }
- if (data.id && data.companyId != null) {
- this.getCompanyIdByApiList(data);
- }
- },
- getCompanyIdByApiList(params) {
- this.form.companyId = params.companyId;
- let companyIndex = this.companyAllList.findIndex(
- (e) => e.value == params.companyId
- );
- this.form.companyIndex = companyIndex;
- },
- getInterviewLableByApiList(params) {
- let interviewTypeIndex = this.dic_SelectList.interviewType.findIndex(
- (e) => e.value == params.interviewType
- );
- this.form.interviewType =
- this.dic_SelectList.interviewType[interviewTypeIndex].value;
- this.form.interviewTypeIndex = interviewTypeIndex;
- },
- getInterviewTime(e) {
- this.form.interviewTime = e.detail.value;
- },
- async takeParamsGoBack(e) {
- const token = uni.getStorageSync("laocui_user_info");
- let data;
- if (e == 1) {
- if (this.form.companyId == null) {
- return this.$showToast("请选择走访公司");
- }
- if (this.form.interviewTime == null || this.form.interviewTime == "") {
- return this.$showToast("请选择走访时间");
- }
- if (this.form.interviewType == null) {
- return this.$showToast("请选择走访类型");
- }
- if (this.form.isStatus == null) {
- return this.$showToast("请选择是否需要处理");
- }
- }
- if (e == 0) {
- data = await editInterview({
- ...this.form,
- status: e,
- createdBy: JSON.parse(token).user.id,
- InterviewUserId: JSON.parse(token).user.id,
- });
- } else {
- data = await addInterview({
- ...this.form,
- status: e,
- createdBy: JSON.parse(token).user.id,
- InterviewUserId: JSON.parse(token).user.id,
- });
- }
- if (data.code == 200) {
- if (e == 1) {
- this.$emit("changeActive");
- this.$showToast("提交成功");
- this.form = { ...form };
- }
- if (e == 0) {
- this.$showToast("保存成功");
- }
- }
- },
- getCompany(e) {
- this.form.companyIndex = e.detail.value;
- this.form.companyId = this.companyAllList[e.detail.value].value;
- },
- chosseAboutCompany() {
- this.show = true;
- // this.$refs.popup.open('top')
- },
- async getCompanyAll() {
- let companyAllList = await getCompanyAll();
- this.companyAllList = companyAllList.map((e) => {
- return {
- label: e.qymc,
- value: e.id,
- };
- });
- this.getBySaveStatus();
- },
- async getByCodes() {
- let data = await getByCodes(JSON.stringify(this.dic_key));
- this.dic_SelectList = this.$common.handleDicList(data);
- this.dic_SelectList.interviewType[0].id;
- },
- confirm(e) {
- let associationCompanyString = [];
- let associationCompany = [];
- for (var p in e) {
- associationCompanyString.push(e[p].label);
- associationCompany.push(e[p].value);
- }
- this.form.associationCompanyString = associationCompanyString.join(",");
- this.form.associationCompany = associationCompany.join(",");
- },
- bindPickerChange(e) {
- this.form.interviewTypeIndex = e.detail.value;
- this.form.interviewType =
- this.dic_SelectList.interviewType[e.detail.value].value;
- },
- },
- // onLoad: function (){
- // this.$refs.findYuanQuList()
- // },
- };
- </script>
- <style lang="scss">
- .btn-view {
- width: 100%;
- height: 100rpx;
- padding: 20rpx 10%;
- background-color: #ffffff;
- position: fixed;
- bottom: 0;
- left: 0;
- }
- .btn {
- width: 40%;
- height: 90rpx;
- border-radius: 8rpx 8rpx 8rpx 8rpx;
- background: #1d18bc;
- line-height: 90rpx;
- color: white;
- float: left;
- }
- .gaisideshurukuang {
- font-size: 26rpx !important;
- .is-input-border {
- border-top: none !important;
- border-left: none !important;
- border-right: none !important;
- border: none;
- border-radius: 0 !important;
- }
- .uni-forms-item {
- border-bottom: 2rpx solid #cccccc !important;
- margin-top: 42rpx !important;
- padding-bottom: 42rpx !important;
- }
- .uni-forms-item__content {
- border-bottom: 2rpx solid #cccccc !important;
- }
- }
- .goreport {
- .textarea_info {
- textarea {
- background: #f9f9f9;
- }
- }
- .form {
- width: calc(100% - 128rpx);
- margin: 32rpx;
- background: #ffffff;
- padding: 32rpx;
- .label {
- height: 53rpx;
- line-height: 53rpx;
- }
- .is-input-border {
- border-top: none !important;
- border-left: none !important;
- border-right: none !important;
- border-radius: 0 !important;
- }
- .uni-forms-item {
- border-bottom: 2rpx solid #cccccc !important;
- margin-top: 42rpx !important;
- padding-bottom: 42rpx !important;
- }
- }
- }
- </style>
|