|
@@ -26,7 +26,7 @@
|
|
|
<a-date-picker
|
|
|
style="width: 100%"
|
|
|
placeholder="请选择购买日期"
|
|
|
- v-model="formState.buyTime"
|
|
|
+ v-model="buyTime"
|
|
|
/>
|
|
|
</a-form-item>
|
|
|
<a-form-item label="购买数量" >
|
|
@@ -55,26 +55,223 @@
|
|
|
</a-form-item>
|
|
|
</a-form>
|
|
|
</a-spin>
|
|
|
+ <a-card :bordered="false" >
|
|
|
+ <div class="purchase-order-table" >
|
|
|
+ <div >
|
|
|
+ <h6 class="table-title" style="float: left">维修服务记录</h6>
|
|
|
+ <a-button @click="addList" type="primary" style="float: right;position: relative;z-index: 11" >新增</a-button>
|
|
|
+ </div>
|
|
|
+ <a-table
|
|
|
+ :columns="Columns"
|
|
|
+ :data-source="List"
|
|
|
+ bordered
|
|
|
+ :pagination="false"
|
|
|
+ >
|
|
|
+ <span slot="headCode" slot-scope="text, record">
|
|
|
+ <span v-show="record.state=='0'">{{record.headCode}}</span>
|
|
|
+ <a-input v-show="record.state=='1'" placeholder="请输入" v-model="record.headCode"/>
|
|
|
+ </span>
|
|
|
+ <span slot="infoDate" slot-scope="text, record">
|
|
|
+ <span v-if="record.state=='0'">{{record.infoDate}}</span>
|
|
|
+ <a-date-picker
|
|
|
+ style="width: 100%"
|
|
|
+ placeholder="请选择时间"
|
|
|
+ v-model="record.infoDate"
|
|
|
+ v-if="record.state=='1'"
|
|
|
+ />
|
|
|
+ </span>
|
|
|
+ <span slot="items" slot-scope="text, record">
|
|
|
+ <span v-if="record.state=='0'">{{record.items}}</span>
|
|
|
+ <a-input v-else placeholder="请输入" v-model="record.items"/>
|
|
|
+ </span>
|
|
|
+ <span slot="cost" slot-scope="text, record">
|
|
|
+ <span v-if="record.state=='0'">{{record.cost}}</span>
|
|
|
+ <a-input v-else placeholder="请输入" v-model="record.cost"/>
|
|
|
+ </span>
|
|
|
+ <span slot="remarks" slot-scope="text, record">
|
|
|
+ <span v-if="record.state=='0'">{{record.remarks}}</span>
|
|
|
+ <a-input v-else placeholder="请输入" v-model="record.remarks"/>
|
|
|
+ </span>
|
|
|
+ <span slot="operation" slot-scope="text, record,index">
|
|
|
+ <a @click="handleEdit(record,'1')">编辑</a>
|
|
|
+ <a-divider type="vertical" />
|
|
|
+ <a @click="handleDelete(index,'1')" style="color:red">删除</a>
|
|
|
+ <a-divider type="vertical" v-if="record.state=='1'"/>
|
|
|
+ <a @click="handleCl(record,'1')" style="color:red" v-if="record.state=='1'">取消</a>
|
|
|
+ </span>
|
|
|
+ </a-table>
|
|
|
+ </div>
|
|
|
+ <div class="purchase-order-table" >
|
|
|
+ <div>
|
|
|
+ <h6 class="table-title" style="float: left">领用记录</h6>
|
|
|
+ <a-button @click="addList1" type="primary" style="float: right;position: relative;z-index: 11" >新增</a-button>
|
|
|
+ </div>
|
|
|
+ <a-table
|
|
|
+ :columns="Columns1"
|
|
|
+ :data-source="List1"
|
|
|
+ bordered
|
|
|
+ :pagination="false"
|
|
|
+ >
|
|
|
+ <span slot="headCode" slot-scope="text, record">
|
|
|
+ <span v-if="record.state=='0'">{{record.headCode}}</span>
|
|
|
+ <a-input v-else placeholder="请输入" v-model="record.headCode"/>
|
|
|
+ </span>
|
|
|
+ <span slot="infoDate" slot-scope="text, record">
|
|
|
+ <span v-if="record.state=='0'">{{record.useDate}}</span>
|
|
|
+ <a-date-picker
|
|
|
+ style="width: 100%"
|
|
|
+ placeholder="请选择时间"
|
|
|
+ v-model="record.useDate"
|
|
|
+ v-if="record.state=='1'"
|
|
|
+ />
|
|
|
+ </span>
|
|
|
+ <span slot="items" slot-scope="text, record">
|
|
|
+ <span v-if="record.state=='0'">{{record.useId}}</span>
|
|
|
+ <a-input v-else placeholder="请输入" v-model="record.useId"/>
|
|
|
+ </span>
|
|
|
+ <span slot="cost" slot-scope="text, record">
|
|
|
+ <span v-if="record.state=='0'">{{record.returnDate}}</span>
|
|
|
+ <a-date-picker
|
|
|
+ style="width: 100%"
|
|
|
+ placeholder="请选择时间"
|
|
|
+ v-model="record.returnDate"
|
|
|
+ v-if="record.state=='1'"
|
|
|
+ />
|
|
|
+ </span>
|
|
|
+ <span slot="remarks" slot-scope="text, record">
|
|
|
+ <span v-if="record.state=='0'">{{record.remarks}}</span>
|
|
|
+ <a-input v-else placeholder="请输入" v-model="record.remarks"/>
|
|
|
+ </span>
|
|
|
+ <span slot="operation" slot-scope="text, record,index">
|
|
|
+ <a @click="handleEdit(record,'2')">编辑</a>
|
|
|
+ <a-divider type="vertical" />
|
|
|
+ <a @click="handleDelete(index,'2')" style="color:red">删除</a>
|
|
|
+ <a-divider type="vertical" v-if="record.state=='1'"/>
|
|
|
+ <a @click="handleCl1(record)" style="color:red" v-if="record.state=='1'">取消</a>
|
|
|
+ </span>
|
|
|
+ </a-table>
|
|
|
+ </div>
|
|
|
+ </a-card>
|
|
|
|
|
|
</a-modal>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-
|
|
|
+import {
|
|
|
+ managementList,
|
|
|
+ managementAdd,
|
|
|
+ managementEdit,
|
|
|
+ enterpriseEDelete
|
|
|
+} from '@api/oa/cd-material-registration'
|
|
|
+import moment from 'moment'
|
|
|
|
|
|
export default {
|
|
|
name: 'AddMaterialRegistration',
|
|
|
components: {
|
|
|
-
|
|
|
+ moment
|
|
|
},
|
|
|
data () {
|
|
|
return {
|
|
|
visible:false,
|
|
|
defult:'add',
|
|
|
+ buyTime:'',
|
|
|
formState:{
|
|
|
|
|
|
},
|
|
|
confirmLoading: false,
|
|
|
+ Columns:[
|
|
|
+
|
|
|
+ {
|
|
|
+ title: '主要信息编号',
|
|
|
+ align: "center",
|
|
|
+ dataIndex: 'headCode',
|
|
|
+ width: 160,
|
|
|
+ scopedSlots: { customRender: 'headCode' },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '日期',
|
|
|
+ align: "center",
|
|
|
+ dataIndex: 'infoDate',
|
|
|
+ width: 180,
|
|
|
+ scopedSlots: { customRender: 'infoDate' },
|
|
|
+
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '维修项目',
|
|
|
+ align: "center",
|
|
|
+ dataIndex: 'items',
|
|
|
+ width: 180,
|
|
|
+ scopedSlots: { customRender: 'items' },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '费用',
|
|
|
+ align: "center",
|
|
|
+ dataIndex: 'cost',
|
|
|
+ width: 120,
|
|
|
+ scopedSlots: { customRender: 'cost' },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '备注',
|
|
|
+ align: "center",
|
|
|
+ dataIndex: 'remarks',
|
|
|
+ width: 120,
|
|
|
+ scopedSlots: { customRender: 'remarks' },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '操作',
|
|
|
+ align: "center",
|
|
|
+ dataIndex: 'operation',
|
|
|
+ scopedSlots: { customRender: 'operation' },
|
|
|
+ width: 180
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ Columns1:[
|
|
|
+ {
|
|
|
+ title: '主要信息编号',
|
|
|
+ align: "center",
|
|
|
+ dataIndex: 'headCode',
|
|
|
+ width: 160,
|
|
|
+ scopedSlots: { customRender: 'headCode' },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '领用日期',
|
|
|
+ align: "center",
|
|
|
+ dataIndex: 'useDate',
|
|
|
+ width: 180,
|
|
|
+ scopedSlots: { customRender: 'infoDate' },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '领用人',
|
|
|
+ align: "center",
|
|
|
+ dataIndex: 'useId',
|
|
|
+ width: 160,
|
|
|
+ scopedSlots: { customRender: 'items' },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '归还日期',
|
|
|
+ align: "center",
|
|
|
+ dataIndex: 'returnDate',
|
|
|
+ width: 180,
|
|
|
+ scopedSlots: { customRender: 'cost' },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '备注',
|
|
|
+ align: "center",
|
|
|
+ dataIndex: 'remarks',
|
|
|
+ width: 120,
|
|
|
+ scopedSlots: { customRender: 'remarks' },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '操作',
|
|
|
+ align: "center",
|
|
|
+ dataIndex: 'operation',
|
|
|
+ scopedSlots: { customRender: 'operation' },
|
|
|
+ width: 180
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ List:[],
|
|
|
+ List1:[],
|
|
|
+
|
|
|
}
|
|
|
},
|
|
|
created () {
|
|
@@ -87,18 +284,118 @@ export default {
|
|
|
close(){
|
|
|
this.visible = false
|
|
|
this.formState={}
|
|
|
- this.defult='add'
|
|
|
+ this.defult='add',
|
|
|
+ this.List =[],
|
|
|
+ this.List1=[],
|
|
|
+ this.buyTime = '',
|
|
|
+ this.defult ='add',
|
|
|
+ this.$emit('close')
|
|
|
},
|
|
|
handleSubmit(){
|
|
|
-
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.formState.buyTime = moment(this.buyTime).format('YYYY-MM-DD');
|
|
|
+ var newObj = this.formState
|
|
|
+ newObj.syMaterialBList = this.List
|
|
|
+ newObj.syMaterialCList =this.List1
|
|
|
+ newObj.syMaterialBList.map(item =>{
|
|
|
+ item.infoDate = moment(item.infoDate).format('YYYY-MM-DD');
|
|
|
+ })
|
|
|
+ newObj.syMaterialCList.map(item=>{
|
|
|
+ item.useDate = moment(item.useDate).format('YYYY-MM-DD');
|
|
|
+ item.returnDate = moment(item.returnDate).format('YYYY-MM-DD');
|
|
|
+ })
|
|
|
+ if(this.defult == 'add'){
|
|
|
+ managementAdd(newObj).then(res => {
|
|
|
+ if (res.success) {
|
|
|
+ this.$message.success('新增成功');
|
|
|
+ this.close()
|
|
|
+ this.$emit('close')
|
|
|
+ }else{
|
|
|
+ this.$message.error(res.message);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }else {
|
|
|
+ managementEdit(newObj).then(res => {
|
|
|
+ if (res.success) {
|
|
|
+ this.$message.success('编辑成功');
|
|
|
+ this.close()
|
|
|
+ }else{
|
|
|
+ this.$message.error(res.message);
|
|
|
+ this.$message.error(res.message);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleEdit(record,data){
|
|
|
+ record.state = '1'
|
|
|
+ record.default = 'edit'
|
|
|
+ if(data == '1'){
|
|
|
+ record.infoDate = moment(record.infoDate)
|
|
|
+ }else{
|
|
|
+ record.useDate = moment(record.useDate)
|
|
|
+ record.returnDate = moment(record.returnDate)
|
|
|
+ }
|
|
|
+
|
|
|
+ this.$forceUpdate()
|
|
|
+
|
|
|
+ },
|
|
|
+ addList(){
|
|
|
+ var line ={
|
|
|
+ headCode:'',
|
|
|
+ infoDate:'',
|
|
|
+ items:'',
|
|
|
+ cost:'',
|
|
|
+ remarks:'',
|
|
|
+ state:'1',
|
|
|
+ default:'add'
|
|
|
+ }
|
|
|
+ this.List.unshift(line)
|
|
|
+ },
|
|
|
+ addList1(){
|
|
|
+ var line ={
|
|
|
+ headCode:'',
|
|
|
+ infoDate:'',
|
|
|
+ items:'',
|
|
|
+ cost:'',
|
|
|
+ remarks:'',
|
|
|
+ state:'1',
|
|
|
+ default:'add'
|
|
|
+ }
|
|
|
+ this.List1.unshift(line)
|
|
|
+ },
|
|
|
+ handleCl(record){
|
|
|
+ if(record.default == 'add'){
|
|
|
+ this.List.shift()
|
|
|
+ }else if(record.default == 'edit'){
|
|
|
+ record.state ='0'
|
|
|
}
|
|
|
+ },
|
|
|
+ handleCl1(record){
|
|
|
+ if(record.default == 'add'){
|
|
|
+ this.List1.shift()
|
|
|
+ }else if(record.default == 'edit'){
|
|
|
+ record.state ='0'
|
|
|
+ this.$forceUpdate()
|
|
|
}
|
|
|
+ },
|
|
|
+ handleDelete(index,data){
|
|
|
+ if(data == '1'){
|
|
|
+ this.List.splice(index, 1);
|
|
|
+ }else{
|
|
|
+ this.List1.splice(index, 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+}
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="less">
|
|
|
/deep/.ant-form{
|
|
|
- display: flex;
|
|
|
+ display: flex !important;
|
|
|
width: 100%;
|
|
|
flex-wrap: wrap;
|
|
|
justify-content: center;
|
|
@@ -106,11 +403,39 @@ export default {
|
|
|
|
|
|
/deep/ .ant-form-item{
|
|
|
display: flex;
|
|
|
- width: 45%;
|
|
|
+ width: 24%;
|
|
|
justify-content: center;
|
|
|
}
|
|
|
/deep/ .ant-form-item-label{
|
|
|
- width: 20%;
|
|
|
+ width: 35%;
|
|
|
+}
|
|
|
+.table-title {
|
|
|
+ margin: 0;
|
|
|
+ border: 1px solid #e8e8e8;
|
|
|
+ background-color: #f2f2f2;
|
|
|
+ border-top-right-radius: 16px;
|
|
|
+ border-bottom: none;
|
|
|
+ font-size: 16px;
|
|
|
+ width: 160px;
|
|
|
+ height: 40px;
|
|
|
+ line-height: 40px;
|
|
|
+ text-align: center;
|
|
|
+}
|
|
|
+.purchase-order-table{
|
|
|
+ margin-bottom: 10px;
|
|
|
+}
|
|
|
+
|
|
|
+/deep/ .ant-card-body{
|
|
|
+ padding: 0px 32px !important;
|
|
|
+}
|
|
|
+/deep/ .ant-divider-horizontal{
|
|
|
+ margin: 13px 0;
|
|
|
+}
|
|
|
+/deep/ .ant-card-body{
|
|
|
+ padding: 0px 32px !important;
|
|
|
+}
|
|
|
+/deep/ .ant-divider-horizontal{
|
|
|
+ margin: 13px 0;
|
|
|
}
|
|
|
|
|
|
|