123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224 |
- <template>
- <view class="page">
- <view class="content">
- <view class="head">
- <span class="title">写日志</span>
- </view>
- <view class="forms">
- <view class="title2">张三的金科环境项目日志</view>
- <view class="title-sub">日志详情</view>
- <uni-forms
- :modelValue="formData"
- label-position="left"
- class="form"
- ref="form"
- :rules="rules"
- >
- <view class="box" v-for="item in formData" :key="item.key">
- <view
- v-show="formData.length > 1"
- class="btn-remove"
- @click="removeFormData(item.key)"
- >-</view
- >
- <uni-forms-item
- required
- label="项目名称"
- name="project_name"
- class="formItem"
- v-if="!project_id"
- >
- <picker
- @change="selectProjectList"
- :range="projectList"
- :range-key="'name'"
- >
- <!-- <view class="select" v-if="formData.industry">
- {{ `${formData.industry.name}(${formData.industry.code})` }}
- </view> -->
- <view class="selectPlaceholder">请选择项目</view>
- </picker>
- </uni-forms-item>
- <uni-forms-item
- required
- label="日志概述"
- name="project_name"
- class="formItem"
- >
- <input
- v-model="formData.project_name"
- class="input"
- placeholder="请输入日志概述"
- />
- </uni-forms-item>
- <uni-forms-item
- required
- label="日志详情"
- name="project_name"
- class="formItem"
- >
- <textarea class="textarea" placeholder="请输入日志详情" />
- </uni-forms-item>
- </view>
- </uni-forms>
- <view class="btn-add" @click="addFormData">+ 新增</view>
- </view>
- <view class="button">提 交</view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- scrollTop: 0,
- projectList: [],
- project_id: '',
- formData: [
- {
- key: +new Date(),
- project_name: "",
- },
- ],
- rules: {
- project_name: {
- rules: [
- {
- required: true,
- errorMessage: "请选择项目名称",
- },
- ],
- },
- },
- };
- },
- onLoad(options) {
- this.project_id = options.project_id;
- },
- methods: {
- selectProjectList(e) {
- // this.formData.version = e.target.value + 1;
- // this.formData.code.version = this.formData.version + "";
- // this.binddata("version", e.target.value);
- },
- addFormData() {
- this.formData.push({
- key: +new Date(),
- project_name: "",
- });
- },
- removeFormData(key) {
- let index = this.formData.findIndex((item) => item.key == key);
- this.formData.splice(index, 1);
- },
- },
- };
- </script>
- <style lang="less" scoped>
- .head {
- width: calc(100% - 60rpx);
- padding: 40rpx;
- position: fixed;
- background: url("~@/static/app-plus/menu-title-bg.png") no-repeat center;
- background-size: 100% 100%;
- background-color: #fff;
- display: flex;
- justify-content: space-between;
- align-items: center;
- z-index: 1;
- .title {
- font: 18px bold;
- color: #fff;
- }
- }
- .forms {
- padding: 40rpx 34rpx;
- padding-top: 168rpx;
- .title2 {
- font-size: 28rpx;
- font-weight: 400;
- color: #4a90e2;
- line-height: 40rpx;
- padding-bottom: 18rpx;
- border-bottom: 1px solid #e8e8e8;
- }
- .title-sub {
- font-size: 28rpx;
- font-weight: 400;
- color: #4a4a4a;
- line-height: 40rpx;
- margin-top: 20rpx;
- margin-bottom: 20rpx;
- }
- .formItem {
- }
- .input,
- .textarea,
- .selectPlaceholder {
- font-size: 28rpx;
- padding-left: 24rpx;
- border: 1rpx solid #c0c0c0;
- }
- .input,
- .selectPlaceholder {
- line-height: 72rpx;
- height: 72rpx;
- }
- .textarea {
- padding-top: 10rpx;
- width: 400rpx;
- height: 200rpx;
- }
- }
- .form {
- margin: 0 20px;
- }
- .button {
- position: fixed;
- bottom: 0;
- left: 0;
- width: 100%;
- height: 100rpx;
- background: url("~@/static/btn-bg.png") no-repeat center;
- background-size: 100% 100%;
- font-size: 38rpx;
- font-weight: 500;
- color: #ffffff;
- line-height: 100rpx;
- text-align: center;
- }
- .btn-add {
- width: 140rpx;
- height: 50rpx;
- border: 1rpx solid #329bfe;
- color: #329bfe;
- display: flex;
- justify-content: center;
- align-items: center;
- margin-left: 48rpx;
- }
- .box {
- position: relative;
- }
- .btn-remove {
- position: absolute;
- right: -10px;
- top: -12px;
- width: 12px;
- height: 12px;
- background: #f54444;
- border-radius: 50%;
- line-height: 20rpx;
- text-align: center;
- color: #fff;
- font-weight: bold;
- }
- .forms {
- padding-bottom: 140rpx;
- }
- </style>
|